/* ───────── Tokens ───────── */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1b1622;
  --ink-2: #4a4453;
  --ink-3: #6f6979;
  --rule: #e4dfe6;
  --accent: #5a2d91;      /* tím Huế */
  --accent-soft: #f0eaf8;
  --bar: #9a7fc4;
  --good: #1b7a4b;
  --grid-line: rgba(90, 45, 145, .16);
  --tint: #f3eef9;
  --tint-soft: #e5dbf3;
  --tint-rule: #dbd1e8;
  --glow: rgba(106, 53, 173, .13);
  --sec-bg: var(--bg);

  --band: #1b1226;        /* nền khối liên hệ, giữ tối ở cả hai chế độ */
  --band-ink: #f3eff8;
  --band-ink-2: #b9b0c6;
  --band-rule: #3a2f49;
  --band-accent: #c7adf5;

  --box: #6a35ad;         /* khung phát hiện trên ảnh: cố định vì ảnh luôn sáng */

  --serif: 'Newsreader', 'Times New Roman', serif;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --nav-h: 64px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --motif: #d9b565;
  --bg: #131018;
  --surface: #1c1823;
  --ink: #f1edf5;
  --ink-2: #c0b9c9;
  --ink-3: #9a93a4;
  --rule: #2e2836;
  --accent: #c7adf5;
  --accent-soft: #2a2138;
  --bar: #7d66a8;
  --good: #63cf9b;
  --grid-line: rgba(199, 173, 245, .13);
  --tint: #1b1624;
  --tint-soft: #352a4a;
  --tint-rule: #372e45;
  --glow: rgba(199, 173, 245, .11);
  --band: #0d0a12;
  color-scheme: dark;
}

/* ───────── Đổi ngôn ngữ ───────── */
.i18n-pending body { visibility: hidden; }
.no-trans .r { transition: none !important; }
.vt-fade::view-transition-old(root) { animation: vtOut .2s ease both; }
.vt-fade::view-transition-new(root) { animation: vtIn .32s ease both; }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; } }

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1.5rem); -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ol, ul { list-style: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--bg); }

.wrap { width: min(100%, 1240px); margin-inline: auto; padding-inline: var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip {
  position: fixed; top: .5rem; left: .5rem; z-index: 200;
  background: var(--accent); color: var(--bg); padding: .5rem 1rem; border-radius: 6px;
  transform: translateY(-200%);
  visibility: hidden;
}
.skip:focus { transform: none; visibility: visible; }

.eyebrow {
  font: 500 .75rem/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ───────── Progress + nav ───────── */
.progress {
  position: fixed; inset: 0 0 auto; height: 2px; z-index: 120;
  background: var(--accent);
  transform: scaleX(var(--p, 0)); transform-origin: left;
}

.nav {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--rule);
}
.nav-inner {
  width: min(100%, 1240px); margin-inline: auto; padding-inline: var(--gutter);
  height: var(--nav-h);
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 500; font-size: .95rem; white-space: nowrap; }
.brand-mark {
  width: 18px; height: 18px; position: relative; color: var(--accent);
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 6px 2px,
    linear-gradient(currentColor, currentColor) 0 0 / 2px 6px,
    linear-gradient(currentColor, currentColor) 100% 0 / 6px 2px,
    linear-gradient(currentColor, currentColor) 100% 0 / 2px 6px,
    linear-gradient(currentColor, currentColor) 0 100% / 6px 2px,
    linear-gradient(currentColor, currentColor) 0 100% / 2px 6px,
    linear-gradient(currentColor, currentColor) 100% 100% / 6px 2px,
    linear-gradient(currentColor, currentColor) 100% 100% / 2px 6px;
  background-repeat: no-repeat;
  transition: transform .5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(90deg); }

.nav-links { position: relative; display: flex; gap: .25rem; margin-left: auto; }
.nav-links a {
  padding: .4rem .75rem; font-size: .875rem; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; transition: color .2s;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.nav-indicator {
  position: absolute; left: 0; bottom: -2px; height: 2px; width: 1px;
  background: var(--accent); opacity: 0; transform-origin: left;
  transition: transform .45s var(--ease), opacity .25s;
}

.theme-btn {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%; color: var(--ink-2);
  transition: color .2s, border-color .2s, transform .4s var(--ease);
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); transform: rotate(18deg); }
.theme-btn svg { width: 18px; height: 18px; grid-area: 1 / 1; }
[data-theme='light'] .i-moon, [data-theme='dark'] .i-sun { display: block; }
[data-theme='light'] .i-sun, [data-theme='dark'] .i-moon { display: none; }

.lang {
  position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px;
  border: 1px solid var(--rule); border-radius: 999px; isolation: isolate;
}
.lang::before {
  content: ''; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: var(--accent);
  transition: transform .4s var(--ease);
}
html[lang='en'] .lang::before { transform: translateX(100%); }
.lang a {
  min-width: 2rem; padding: .22rem .4rem; text-align: center;
  font: 500 .75rem/1.5 var(--mono); color: var(--ink-3); transition: color .25s;
}
.lang a:hover { color: var(--ink); }
.lang a[aria-current] { color: var(--bg); }

/* Hiệu ứng đổi theme: vòng tròn mở rộng từ nút bấm */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ───────── Hero ───────── */
.hero { position: relative; margin-top: calc(var(--nav-h) * -1); padding-top: var(--nav-h); isolation: isolate; }
.hero-grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(420px circle at var(--mx, 72%) var(--my, 42%), #000 0%, transparent 100%);
  mask-image: radial-gradient(420px circle at var(--mx, 72%) var(--my, 42%), #000 0%, transparent 100%);
}
/* Cầu Trường Tiền mờ ở chân phần đầu trang, sau hàng số liệu */
.hero-bridge {
  position: absolute; left: 0; right: 0; bottom: 16px; height: clamp(300px, 34vw, 500px); z-index: -2; pointer-events: none;
  background: url("assets/images/hue/bridge-panorama.jpg") center bottom -12vw / max(100%, 1100px) auto no-repeat;
  opacity: .2; mix-blend-mode: multiply;
  /* Trong suốt hẳn trước khi tới mép trên của ảnh, để không lộ đường cắt ngang */
  -webkit-mask-image: linear-gradient(to top, #000 38%, transparent 70%);
  mask-image: linear-gradient(to top, #000 38%, transparent 70%);
}
[data-theme='dark'] .hero-bridge { opacity: .22; mix-blend-mode: screen; }
/* Hiệu ứng Hero: cầu nổi dần khi tải trang; khi cuộn, các lớp trôi với tốc độ khác nhau */
.hero { overflow: clip; }
.hero-bridge { translate: 0 var(--bridge-y, 0px); animation: bridgeIn 2s .25s var(--ease) both; }
@keyframes bridgeIn { from { opacity: 0; transform: translateY(46px) scale(1.07); } }
.hero-copy { translate: 0 var(--copy-y, 0px); }
.portrait { translate: 0 var(--photo-y, 0px); }
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
  padding-block: clamp(2rem, 5vh, 4rem) clamp(2.5rem, 6vh, 4.5rem);
}
.hero-name {
  font: 300 clamp(2.25rem, 3.4vw, 3rem)/1.1 var(--serif);
  letter-spacing: -.02em;
  margin: 1.1rem 0 1.4rem;
  font-optical-sizing: auto;
}
.hero-name .line { display: inline-block; }
.hero-degree { margin-right: .28em; font-size: .5em; font-style: italic; letter-spacing: 0; color: var(--accent); }
.hero-degree-after { margin-right: 0; font-style: normal; color: var(--ink-2); }
.hero-name .line + .line { font-style: italic; color: var(--accent); padding-left: .24em; }
.hero-name.intro .line { animation: nameIn 1.25s var(--ease) both; animation-delay: calc(.12s + var(--c) * 220ms); }
@keyframes nameIn {
  from { opacity: 0; transform: translateY(.12em); clip-path: inset(-25% 100% -35% -6%); }
  to { opacity: 1; transform: none; clip-path: inset(-25% -6% -35% -6%); }
}

.hero-affil { font-weight: 500; color: var(--ink); }
.hero-lead { margin-top: .9rem; max-width: 34rem; color: var(--ink-2); font-size: 1.0625rem; }
.hero-lead p + p { margin-top: .75rem; }
.hero-highlight { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .9rem; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--rule); max-width: 34rem; font-size: .875rem; animation: rise .7s var(--ease) both; }
.hero-highlight[hidden] { display: none; }
.hl-lead { flex-basis: 100%; font: 500 .75rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.hero-highlight .tlink { font-size: .875rem; color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.hero-enter { animation: rise .9s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .72rem 1.25rem; border-radius: 999px; font-weight: 500; font-size: .9375rem;
  transition: transform .3s var(--ease), background-color .2s, box-shadow .3s;
}
.btn svg { width: 17px; height: 17px; transition: transform .35s var(--ease); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px var(--accent); }
.btn-primary:hover svg { transform: translateY(3px); }
.btn:active { transform: translateY(0) scale(.98); }

.tlink {
  position: relative; display: inline-flex; align-items: center; gap: .3rem;
  font-size: .9rem; font-weight: 500; color: var(--ink); padding-block: .2rem;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  background-size: 0 1px; transition: background-size .35s var(--ease), color .2s;
}
.tlink:hover { background-size: 100% 1px; color: var(--accent); }
.tlink::after { content: '↗'; font-size: .8em; color: var(--ink-3); transition: transform .3s var(--ease), color .2s; }
.tlink:hover::after { transform: translate(2px, -2px); color: currentColor; }
.tlink[href^='mailto:']::after { content: none; }

/* Chân dung + khung phát hiện */
.portrait { position: relative; }
.motion-btn {
  position: absolute; left: 50%; bottom: .75rem; z-index: 2; transform: translateX(-50%);
  max-width: calc(100% - 1.5rem); padding: .45rem .85rem; white-space: nowrap; border-radius: 999px;
  font-size: .8125rem; font-weight: 500; color: #fff; background: rgba(27, 18, 38, .78);
}
.motion-btn[hidden] { display: none; }
.portrait { justify-self: end; width: min(100%, 410px); perspective: 1400px; animation: rise 1.1s .15s var(--ease) both; }
.portrait-tilt {
  position: relative; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease);
}
.portrait-3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .8s ease; }
.portrait-3d.is-ready { opacity: 1; }
/* Tấm lưới phía sau ảnh: lệch đi khi ảnh nghiêng, tạo chiều sâu */
.portrait-tilt::before {
  content: ''; position: absolute; inset: 22px -24px -24px 22px; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background-color: color-mix(in srgb, var(--tint) 70%, transparent);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  transform: translateZ(-60px);
}
.portrait-frame { position: relative; overflow: hidden; border-radius: 6px; background: var(--rule); box-shadow: 0 30px 60px -36px rgba(27, 18, 38, .55); }
.portrait-frame img { width: 100%; transform: scale(1.06); }
.scanline {
  position: absolute; left: 0; right: 0; top: 0; height: 22%;
  background: linear-gradient(to bottom, transparent, rgba(106, 53, 173, .22));
  border-bottom: 1.5px solid var(--box);
  transform: translateY(-100%);
  animation: scan 1.5s .55s cubic-bezier(.45, 0, .4, 1) both;
}
@keyframes scan {
  0% { transform: translateY(-100%); opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateY(460%); opacity: 0; }
}

.bbox {
  position: absolute; border: 1.5px solid var(--box); border-radius: 2px;
  transform: translateZ(22px);
  translate: calc(var(--bx, 0px) * var(--bd, 0)) calc(var(--by, 0px) * var(--bd, 0));
  animation: boxIn .55s var(--ease) both;
}
.bbox::before, .bbox::after {
  content: ''; position: absolute; width: 10px; height: 10px; border: 3px solid var(--box);
}
.bbox::before { right: -2px; top: -2px; border-left: 0; border-bottom: 0; }
.bbox::after { left: -2px; bottom: -2px; border-right: 0; border-top: 0; }
.bbox-face { --bd: .55; left: 25.6%; top: .2%; width: 42.4%; height: 38.2%; animation-delay: 1.15s; }
.bbox-logo { --bd: .25; left: 55.3%; top: 62%; width: 12.2%; height: 4.9%; animation-delay: 1.5s; }
.bbox-label {
  position: absolute; left: -1.5px; bottom: 100%;
  background: var(--box); color: #fff; white-space: nowrap;
  font: 500 .6875rem/1 var(--mono); padding: .3rem .42rem; border-radius: 2px 2px 0 0;
}
.bbox-label b { font-weight: 500; font-variant-numeric: tabular-nums; opacity: .85; margin-left: .25rem; }
@keyframes boxIn { from { opacity: 0; transform: translateZ(22px) scale(1.14); } }
/* Màn hình cảm ứng không có con trỏ: ảnh tự lắc rất nhẹ */
@media (hover: none) {
  .portrait-tilt { animation: sway 9s ease-in-out infinite alternate; }
}
.portrait-tilt.has-motion { animation: none; transition: transform .2s linear; }
@keyframes sway {
  from { transform: rotateY(-4deg) rotateX(1deg); }
  to { transform: rotateY(4deg) rotateX(-1deg); }
}

/* Số liệu */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); }
.stats.has-metrics { grid-template-columns: repeat(6, 1fr); }
.stats .stat[hidden] { display: none; }
.stat dt a { text-decoration: underline; text-underline-offset: 2px; }
.stat dt a:hover { color: var(--accent); }
.stats.has-metrics .stat { padding-inline: 1rem; }
.stats.has-metrics .stat:first-child { padding-left: 0; }
.stat { padding: 1.4rem 1.5rem 1.5rem; border-left: 1px solid var(--rule); display: flex; flex-direction: column; }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dd { font: 400 clamp(2.4rem, 4.4vw, 3.4rem)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; }
.stat dt { margin-top: .55rem; font-size: .8125rem; line-height: 1.4; color: var(--ink-2); max-width: 15rem; }

/* ───────── Sections ───────── */
.sec { position: relative; isolation: isolate; overflow: clip; padding-block: clamp(4rem, 9vw, 7rem); background: var(--sec-bg); }
.sec-tint { --sec-bg: var(--tint); --accent-soft: var(--tint-soft); --rule: var(--tint-rule); }

/* Nền trang trí: cùng ngôn ngữ với lưới ở đầu trang, sáng theo con trỏ */
.bg-lines {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(var(--spot, 520px) circle at var(--mx, var(--dx, 80%)) var(--my, var(--dy, 30%)), #000 0%, transparent 100%);
  mask-image: radial-gradient(var(--spot, 520px) circle at var(--mx, var(--dx, 80%)) var(--my, var(--dy, 30%)), #000 0%, transparent 100%);
}
.bg-lines-research { --dx: 88%; --dy: 40%; --spot: 560px; }
.bg-lines-pubs { --dx: 92%; --dy: 120px; --spot: 460px; }
.bg-lines-projects { --dx: 6%; --dy: 72%; --spot: 620px; }
.bg-lines-contact { --dx: 84%; --dy: 24%; --spot: 600px; --grid-line: rgba(199, 173, 245, .17); }

.bg-glow {
  position: absolute; z-index: -1; width: 760px; height: 760px; max-width: 150vw; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--glow), transparent);
  animation: drift 22s ease-in-out infinite alternate;
}
.bg-glow-research { right: -240px; top: -300px; }
.bg-glow-pubs { right: -300px; top: -340px; animation-delay: -7s; }
.bg-glow-projects { left: -320px; bottom: -280px; animation-delay: -12s; }
.bg-glow-contact { right: -200px; top: -360px; --glow: rgba(150, 100, 230, .3); animation-delay: -4s; }
@keyframes drift { to { transform: translate(-90px, 70px) scale(1.12); } }

.sec-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: clamp(1.5rem, 4vw, 3.5rem); }
.sec-head { align-self: start; position: sticky; top: calc(var(--nav-h) + 1.5rem); }
.sec-no { font: 500 .75rem var(--mono); color: var(--accent); }
.sec-head h2 { font: 400 clamp(1.75rem, 2.6vw, 2.25rem)/1.14 var(--serif); letter-spacing: -.012em; margin-top: .45rem; }
.sec-note { margin-top: .75rem; font-size: .8125rem; color: var(--ink-3); }
.sec-note b { color: var(--accent); font-weight: 600; }
.sub-title { font: 500 .75rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 1rem; }

/* Xuất hiện khi cuộn */
.js .r { opacity: 0; transform: translateY(22px); transition: opacity .85s var(--ease), transform .85s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.js .r.in { opacity: 1; transform: none; }

/* ───────── Học vấn và công tác ───────── */
.bg-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem clamp(1.5rem, 4vw, 3.5rem); }
.bg-list li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.bg-when { grid-row: span 2; padding-top: .2rem; font: 400 .75rem var(--mono); color: var(--ink-3); }
.bg-what { grid-column: 2; font: 400 1.125rem/1.3 var(--serif); }
.bg-where { grid-column: 2; font-size: .875rem; color: var(--ink-2); }
.bg-note, .bg-areas { font-size: .875rem; color: var(--ink-2); }
.bg-note { padding-top: .7rem; border-top: 1px solid var(--rule); }
.bg-sub { margin-top: 1.75rem; }

/* ───────── Hướng nghiên cứu ───────── */
.cloud-hint { margin-top: .25rem; text-align: center; font: 400 .6875rem var(--mono); color: var(--ink-3); }
.interests {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .55em .75em;
  font: 400 clamp(1.25rem, 1.9vw, 1.625rem)/1.2 var(--serif);
  letter-spacing: -.012em;
}
.interest { position: relative; z-index: 1; display: inline-block; max-width: 100%; cursor: default; color: var(--ink); transition: color .35s; }
.interest.is-on { color: var(--accent); }
.detector {
  position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .75s var(--ease), width .75s var(--ease), height .75s var(--ease), opacity .4s;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 12px 2px,
    linear-gradient(var(--accent), var(--accent)) 0 0 / 2px 12px,
    linear-gradient(var(--accent), var(--accent)) 100% 0 / 12px 2px,
    linear-gradient(var(--accent), var(--accent)) 100% 0 / 2px 12px,
    linear-gradient(var(--accent), var(--accent)) 0 100% / 12px 2px,
    linear-gradient(var(--accent), var(--accent)) 0 100% / 2px 12px,
    linear-gradient(var(--accent), var(--accent)) 100% 100% / 12px 2px,
    linear-gradient(var(--accent), var(--accent)) 100% 100% / 2px 12px;
  background-repeat: no-repeat;
}
.detector.is-live { opacity: 1; }

/* ───────── Nghiên cứu qua hình ảnh ───────── */
.apps-block { margin-top: clamp(2.5rem, 5vw, 4rem); }
.apps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1.25rem; }
.app-desc { margin-top: .25rem; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.app-papers { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; margin-top: .35rem; font-size: .8125rem; }
.app-papers .tlink { font-size: .8125rem; font-weight: 400; color: var(--accent); }
.app-paper { font-size: .8125rem; color: var(--ink-2); }
.app-papers .tag { margin-top: .1rem; }
.apps-note { margin-top: 1.25rem; font-size: .75rem; color: var(--ink-3); }

/* ───────── Mô hình nghiên cứu ───────── */
.sec-band {
  --sec-bg: var(--band); --bg: var(--band); --ink: var(--band-ink); --ink-2: var(--band-ink-2); --ink-3: #a39aaf;
  --rule: var(--band-rule); --accent: var(--band-accent); --accent-soft: #2f2540; --warm: #f3c98b;
  --grid-line: rgba(199, 173, 245, .17); --glow: rgba(150, 100, 230, .3);
  color: var(--ink);
}
.bg-lines-models { --dx: 82%; --dy: 34%; --spot: 640px; }
.bg-glow-models { right: -220px; top: -280px; animation-delay: -9s; }
.tasks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .875rem; margin-top: .25rem; }
.task-card { display: flex; flex-direction: column; justify-content: flex-start; width: 100%; padding: .5rem .5rem .75rem; text-align: left; color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; transition: opacity .85s var(--ease), transform .85s var(--ease), border-color .25s, background-color .25s; }
.task-card:hover { border-color: var(--accent); }
.task-card.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.task-card .place-photo { width: 100%; flex: none; }
.task-card .bbox-label { bottom: auto; top: -1.5px; border-radius: 0 0 2px 0; }
.task-text { display: block; margin-top: .6rem; padding-inline: .25rem; }
.task-name { display: block; font: 400 1.125rem/1.25 var(--serif); }
.task-card.is-on .task-name { color: var(--accent); }
.task-out { display: block; margin-top: .15rem; font-size: .8125rem; line-height: 1.4; color: var(--ink-2); }
.task-chip { position: absolute; left: 6px; top: 6px; padding: .3rem .45rem; border-radius: 2px; background: var(--box); color: #fff; font: 500 .6875rem/1 var(--mono); white-space: nowrap; }
.task-chip b { font-weight: 500; opacity: .85; margin-left: .25rem; }
.task-frames { position: absolute; inset: 0; background: #120c1a; }
.task-frames span { position: absolute; width: 64%; aspect-ratio: 3 / 2; overflow: hidden; border: 1px solid rgba(255, 255, 255, .6); border-radius: 2px; }
.task-frames span:nth-child(1) { left: 5%; top: 18%; opacity: .55; }
.task-frames span:nth-child(2) { left: 18%; top: 25%; opacity: .78; }
.task-frames span:nth-child(3) { left: 31%; top: 32%; }
.task-frames span img { position: absolute; left: 0; top: 0; width: 125%; height: auto; max-width: none; object-fit: fill; }
.task-frames span:nth-child(1) img { transform: translate(-1%, -1%); }
.task-frames span:nth-child(2) img { transform: translate(-9%, -9%); }
.task-frames span:nth-child(3) img { transform: translate(-17%, -17%); }
.task-mask { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.task-mask polygon { fill: rgba(243, 201, 139, .62); stroke: #f3c98b; stroke-width: 2; stroke-linejoin: round; }
.place.in .task-mask { animation: panoBoxIn .7s var(--ease) both; animation-delay: calc(.75s + var(--i, 0) * 120ms); }
.place.in.no-replay .task-mask { animation: none; opacity: 1; }
.task-credit { margin-top: .5rem; font-size: .75rem; color: var(--ink-3); }
.task-credit a { text-decoration: underline; text-underline-offset: 2px; }
.task-detail { margin-top: 1.25rem; }
.task-question { font: 400 clamp(1.375rem, 2.2vw, 1.75rem)/1.25 var(--serif); }
.task-use { margin-top: .25rem; font-size: .9375rem; color: var(--ink-2); }
.model-sub { margin-top: 2rem; }
.model-summary { margin-top: 1rem; max-width: 46rem; color: var(--ink-2); }
.model-source { margin-top: .4rem; font-size: .875rem; color: var(--ink-3); }
.model-source .tlink { font-size: .875rem; }
.model-stage { margin-top: 1rem; }
.model-stage canvas { display: block; width: 100%; aspect-ratio: 16 / 9; cursor: grab; touch-action: pan-y; }
.model-stage canvas.on-marker { cursor: pointer; }
.model-stage canvas.is-dragging { cursor: grabbing; }
.model-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; margin-top: 1.25rem; border-top: 1px solid var(--rule); }
.step {
  display: flex; gap: .75rem; width: 100%; height: 100%; padding: .8rem .5rem; text-align: left;
  border-bottom: 1px solid var(--rule); transition: background-color .2s;
}
.step-no {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  font: 500 .6875rem var(--mono); background: var(--accent); color: var(--band); transition: background-color .2s;
}
.step b { display: block; font-weight: 500; font-size: .9375rem; color: var(--ink); }
.step b + span { display: block; font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
.step.is-on { background: var(--accent-soft); }
.step.is-on .step-no { background: var(--warm); }
.model-papers { margin-top: 1.75rem; }
.model-papers li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; font-size: .9375rem; }
.model-papers li + li { margin-top: .45rem; }

/* ───────── Công trình ───────── */
.featured-block { margin-bottom: 3.25rem; }
.featured { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; perspective: 1100px; }
.feat {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .8rem;
  padding: 1.25rem; min-height: 15rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  transition: opacity .85s var(--ease), transform .5s var(--ease), border-color .25s, box-shadow .4s;
}
.feat::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--x, 50%) var(--y, 0), var(--accent-soft), transparent 70%);
}
.feat > * { position: relative; }
.feat-venue { font: 500 .8125rem/1.35 var(--sans); color: var(--accent); }
.feat-title { font: 400 1.25rem/1.25 var(--serif); }
.feat-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.feat-arrow { font-size: 1.1rem; color: var(--ink-3); transition: transform .35s var(--ease), color .2s; }

.pub-panel { margin-bottom: 1.25rem; }
.hist { display: flex; align-items: stretch; gap: 2px; height: 128px; max-width: 640px; margin-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.hist-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  position: relative; padding-top: 1.4rem;
}
.hist-n {
  font: 500 .75rem/1 var(--mono); color: var(--ink); margin-bottom: .3rem;
  font-variant-numeric: tabular-nums;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .25s var(--ease);
}
.hist-bar {
  display: block; width: min(60%, 44px); height: var(--h);
  background: var(--bar); border-radius: 4px 4px 0 0;
  transform: scaleY(0); transform-origin: bottom;
  transition: background-color .2s, transform .9s var(--ease);
  transition-delay: 0s, calc(var(--k) * 60ms);
}
.hist.in .hist-bar { transform: none; }
.hist-col:hover .hist-bar { background: color-mix(in srgb, var(--accent) 60%, var(--bar)); }
.hist-col[aria-pressed='true'] .hist-bar { background: var(--accent); }
.hist-col:hover .hist-n, .hist-col[aria-pressed='true'] .hist-n, .hist-col.is-peak .hist-n { opacity: 1; transform: none; }
.hist-years { display: flex; gap: 2px; max-width: 640px; margin: -1.2rem 0 1.5rem; }
.hist-years span { flex: 1; min-width: 0; display: flex; justify-content: center; white-space: nowrap; font: 400 .75rem var(--mono); color: var(--ink-3); }

.pub-controls { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  padding: .4rem .85rem; font-size: .8125rem; font-weight: 500; color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: 999px;
  transition: color .2s, background-color .2s, border-color .2s, transform .2s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip:active { transform: scale(.96); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.search {
  flex: 1 1 15rem; max-width: 20rem; display: flex; align-items: center; gap: .5rem;
  padding: .4rem .85rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-3);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { width: 100%; min-width: 0; background: none; border: 0; outline: 0; font-size: .875rem; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.pub-count { margin-top: 1rem; font-size: .8125rem; color: var(--ink-3); }

.more-btn {
  display: block; width: 100%; margin-top: 1.25rem; padding: .85rem 1rem;
  font-size: .9375rem; font-weight: 500; color: var(--accent);
  border: 1px solid var(--rule); border-radius: 8px;
  transition: background-color .25s, border-color .25s, transform .2s var(--ease);
}
.more-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.more-btn:active { transform: scale(.99); }

.pub-year { display: grid; grid-template-columns: 5.75rem minmax(0, 1fr); gap: 0 1rem; border-top: 1px solid var(--ink); }
.pub-year-label { font: 400 1.5rem/1 var(--serif); font-variant-numeric: lining-nums; padding-top: 1.25rem; position: sticky; top: calc(var(--nav-h) + 1rem); align-self: start; }
.pub-year-label small { display: block; margin-top: .35rem; font: 400 .6875rem var(--mono); color: var(--ink-3); white-space: nowrap; }
.pub-year + .pub-year { margin-top: 2rem; }
.pub { position: relative; padding: 1.25rem 0; }
.pub-list.animate .pub { animation: rise .55s var(--ease) both; animation-delay: calc(var(--n, 0) * 28ms); }
.pub + .pub { border-top: 1px solid var(--rule); }
.pub-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font: 500 .6875rem/1.2 var(--sans); padding: .22rem .5rem; border-radius: 3px;
  background: var(--accent-soft); color: var(--accent);
}
.tag-plain { background: none; padding-inline: 0; color: var(--ink-3); }
.tag-line { background: none; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-2); }
.pub-title { font: 400 1.1875rem/1.32 var(--serif); }
.pub-title a {
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease), color .2s;
}
.pub-title a:hover { background-size: 100% 1px; color: var(--accent); }
.pub-authors { margin-top: .4rem; font-size: .875rem; color: var(--ink-2); }
.pub-authors strong { font-weight: 600; color: var(--ink); }
.pub-venue { font-size: .875rem; color: var(--ink-3); }
.pub-venue em { font-family: var(--serif); font-size: 1.05em; color: var(--ink-2); }
.pub-actions { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .55rem; }
.pub-act { font: 400 .75rem var(--mono); color: var(--ink-3); transition: color .2s; overflow-wrap: anywhere; text-align: left; }
.pub-act:hover { color: var(--accent); }
.pub-empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-3); border-top: 1px solid var(--ink); }
.pub-empty a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.skeleton { border-top: 1px solid var(--ink); padding-top: 1.25rem; display: grid; gap: 1.5rem; }
.skeleton i {
  display: block; height: 3.5rem; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-soft) 25%, var(--rule) 50%, var(--accent-soft) 75%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

/* ───────── Đề tài ───────── */
.timeline { position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 4.5px; top: .6rem; bottom: .6rem; width: 1px; background: var(--rule);
}
.tl { position: relative; padding: 0 0 2rem 2rem; }
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: ''; position: absolute; left: 0; top: .5rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sec-bg); box-shadow: inset 0 0 0 2px var(--ink-3);
}
.tl.is-live::before { background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
.tl-when { font: 400 .75rem var(--mono); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.tl-live { color: var(--accent); font-weight: 500; }
.tl-title { font: 400 1.1875rem/1.32 var(--serif); margin: .3rem 0 .35rem; }
.tl-meta { font-size: .875rem; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; }

/* ───────── Giảng dạy ───────── */
.courses { border-top: 1px solid var(--ink); }
.course {
  position: relative; isolation: isolate; display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: .25rem 1rem; align-items: center;
  padding: 1.35rem .75rem; border-bottom: 1px solid var(--rule);
}
.course::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--accent-soft);
  transform: scaleX(0); transform-origin: left; transition: transform .55s var(--ease);
}
.course-no { font: 400 .75rem var(--mono); color: var(--ink-3); }
.course-name { display: block; font: 400 clamp(1.25rem, 2vw, 1.5rem)/1.25 var(--serif); }
.course-desc { display: block; margin-top: .2rem; font-size: .875rem; color: var(--ink-2); }
.course-go {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%; color: var(--ink-2);
  transition: background-color .3s, color .3s, border-color .3s, transform .45s var(--ease);
}
.course-go svg { width: 16px; height: 16px; }

.book {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
  margin-top: 3rem; padding: clamp(1.25rem, 3vw, 2.25rem); border-radius: 12px;
  background-color: var(--tint);
  --book-line: color-mix(in srgb, var(--grid-line) 40%, transparent);
  background-image:
    linear-gradient(var(--book-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--book-line) 1px, transparent 1px),
    radial-gradient(420px circle at 6% 50%, var(--glow), transparent);
  background-size: 40px 40px, 40px 40px, auto;
  --accent-soft: var(--tint-soft);
}
.book-3d { perspective: 900px; padding: .5rem 1.25rem .5rem .25rem; }
.book-cover {
  position: relative; width: 148px; height: 208px; padding: 1.1rem .9rem .9rem 1.2rem;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; background: #4a2479; border-radius: 2px 5px 5px 2px;
  transform: rotateY(-24deg); transform-style: preserve-3d;
  transition: transform .7s var(--ease);
  box-shadow: 14px 16px 28px -14px rgba(27, 18, 38, .65);
}
.book-cover::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .22); }
.book-cover::after {
  content: ''; position: absolute; top: 3px; bottom: 3px; right: -11px; width: 12px;
  background: repeating-linear-gradient(to right, #f4f0ea 0 1px, #d9d2c8 1px 2px);
  transform: rotateY(90deg); transform-origin: left;
}
.book-kind { font: 500 .625rem var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .78; }
.book-name { font: 400 1.25rem/1.14 var(--serif); }
.book-pub { font-size: .625rem; opacity: .78; }
.book-info h3 { font: 400 1.5rem/1.2 var(--serif); margin: .35rem 0 .5rem; }
.book-info p { font-size: .875rem; color: var(--ink-2); }
.book-info .mono { font: 400 .75rem var(--mono); color: var(--ink-3); margin-top: .5rem; }

/* ───────── Huế và nhà trường ───────── */
.pano {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; aspect-ratio: 1920 / 620; min-height: 300px; background: #39465a; color: #fff;
}
.pano-layer {
  position: absolute; z-index: -2; top: 50%; left: var(--px, 50%);
  width: max(100%, 900px); aspect-ratio: 1920 / 722;
  transform: translate(-50%, calc(-50% + var(--py, 0px)));
}
.pano-layer img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pano::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, rgba(20, 12, 30, .84), rgba(20, 12, 30, .34) 34%, transparent 58%);
}
.pano-box {
  position: absolute; left: 26.5%; top: 49.5%; width: 62.5%; height: 12.5%;
  border: 1.5px solid #fff; border-radius: 2px; opacity: 0;
  box-shadow: 0 0 0 1px rgba(20, 12, 30, .35);
}
.pano-box .bbox-label { left: -1.5px; }
.pano.in .pano-box { animation: panoBoxIn .8s .35s var(--ease) both; }
@keyframes panoBoxIn {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: none; }
}
.pano-text { position: absolute; left: 0; right: 0; bottom: clamp(1.25rem, 3vw, 2.5rem); }
.pano-text .eyebrow { color: #e3d6fa; }
.pano-text h2 { margin-top: .4rem; font: 400 clamp(1.75rem, 3.6vw, 3rem)/1.1 var(--serif); letter-spacing: -.012em; max-width: 16em; }
.pano-credit { position: absolute; right: var(--gutter); bottom: .5rem; font-size: .6875rem; color: rgba(255, 255, 255, .8); }
.pano-credit a { text-decoration: underline; text-underline-offset: 2px; }

.places-sec .sec-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.places-sec .sec-head { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 28rem); column-gap: 2rem; align-items: end; }
.places-sec .sec-no { grid-column: 1 / -1; }
.places-sec .sec-note { margin-top: 0; }
.places { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem 1.25rem; }
.place-photo { position: relative; overflow: hidden; border-radius: 6px; aspect-ratio: 3 / 2; background: var(--rule); }
.place-stage { position: absolute; inset: 0; transition: transform .9s var(--ease); }
.place-stage img { width: 100%; height: 100%; object-fit: cover; }
.place-box {
  position: absolute; border: 1.5px solid #fff; border-radius: 2px; opacity: 0;
  box-shadow: 0 0 0 1px rgba(20, 12, 30, .4);
}
.place-box::before, .place-box::after { content: ''; position: absolute; width: 10px; height: 10px; border: 3px solid var(--box); }
.place-box::before { left: -2px; top: -2px; border-right: 0; border-bottom: 0; }
.place-box::after { right: -2px; bottom: -2px; border-left: 0; border-top: 0; }
.place-box .bbox-label { left: -1.5px; }
.place-box .bbox-label.is-right { left: auto; right: -1.5px; }
.place-box .bbox-label.is-inside { bottom: auto; top: -1.5px; border-radius: 2px 0 2px 0; }
.place-box:not(.is-tiny) { z-index: 1; }
.place-box.is-tiny { border-width: 1px; box-shadow: 0 0 0 .5px rgba(20, 12, 30, .55); }
.place-box.is-tiny::before, .place-box.is-tiny::after { content: none; }
.place-box.tone-warm { border-color: #f3c98b; }
.place-box.tone-warm::before, .place-box.tone-warm::after { border-color: #f3c98b; }
.place-box.tone-warm .bbox-label { background: #f3c98b; color: #33195a; }
.place.in .place-box { animation: panoBoxIn .7s var(--ease) both; animation-delay: calc(.75s + var(--i, 0) * 120ms + var(--b, 0) * 35ms); }
.place-scan { animation: none; opacity: 0; }
.place.in .place-scan { animation: scan 1.15s cubic-bezier(.45, 0, .4, 1) both; animation-delay: calc(.1s + var(--i, 0) * 120ms); }
.place.in.no-replay .place-box { animation: none; opacity: 1; }
.place.in.no-replay .place-scan { animation: none; opacity: 0; }
.place figcaption { margin-top: .6rem; }
.place figcaption span { display: block; font: 400 1.0625rem/1.3 var(--serif); }
.place figcaption small { display: block; margin-top: .2rem; font-size: .75rem; color: var(--ink-3); }
.place figcaption a { text-decoration: underline; text-underline-offset: 2px; }
.place figcaption a:hover { color: var(--accent); }

/* ───────── Liên hệ ───────── */
.contact { position: relative; isolation: isolate; overflow: clip; background: var(--band); color: var(--band-ink); padding-top: clamp(4rem, 9vw, 7rem); }
.contact .eyebrow { color: var(--band-accent); }
.contact-lead { font: 400 clamp(1.375rem, 2.2vw, 1.75rem)/1.25 var(--serif); letter-spacing: -.01em; margin-top: .9rem; color: var(--band-ink); max-width: 16em; }
.contact-mail { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1.5rem; }
.mail-big {
  font: 500 clamp(1.0625rem, 1.6vw, 1.25rem)/1.4 var(--sans); overflow-wrap: anywhere; padding-bottom: .1rem;
  background: linear-gradient(var(--band-accent), var(--band-accent)) 0 100% / 0 1px no-repeat;
  transition: background-size .55s var(--ease), color .25s;
}
.mail-big:hover { background-size: 100% 1px; color: var(--band-accent); }
.copy-btn {
  padding: .4rem .85rem; font-size: .8125rem; font-weight: 500; color: var(--band-ink);
  border: 1px solid var(--band-rule); border-radius: 999px; transition: border-color .2s, color .2s;
}
.copy-btn:hover { border-color: var(--band-accent); color: var(--band-accent); }
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 2.5rem; margin-top: clamp(2.5rem, 5vw, 4rem); padding-top: 1.75rem; border-top: 1px solid var(--band-rule); }
.contact-grid h3 { font: 500 .75rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--band-ink-2); margin-bottom: .5rem; }
.contact-grid p, .contact-grid li { font-size: .9375rem; }
.contact-grid li + li { margin-top: .2rem; }
.contact .tlink { color: var(--band-ink); font-size: .9375rem; }
.contact .tlink:hover { color: var(--band-accent); }
.contact .tlink::after { color: var(--band-ink-2); }
.contact :focus-visible { outline-color: var(--band-accent); }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem;
  margin-top: clamp(3rem, 6vw, 5rem); padding-block: 1.5rem; border-top: 1px solid var(--band-rule);
  font-size: .8125rem; color: var(--band-ink-2);
}
.foot a:hover { color: var(--band-accent); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 150;
  padding: .55rem 1rem; border-radius: 999px; font-size: .875rem; max-width: calc(100vw - 2rem);
  background: var(--ink); color: var(--bg);
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity .25s, transform .35s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Chỉ khi có chuột ───────── */
@media (hover: hover) {
  .js .feat.r.in:hover {
    transform: translateY(-4px) rotateX(var(--trx, 0deg)) rotateY(var(--try, 0deg));
    transition: transform .25s var(--ease), border-color .25s, box-shadow .4s;
    transition-delay: 0s;
  }
  .feat:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); box-shadow: 0 22px 38px -28px rgba(27, 18, 38, .5); }
  .feat:hover::before { opacity: 1; }
  .feat:hover .feat-arrow { transform: translate(3px, -3px); color: var(--accent); }
  .place:hover .place-stage { transform: scale(1.04); }
  .place:hover .place-box:not(.tone-warm):not(.is-tiny) { border-color: #fff; box-shadow: 0 0 0 1px rgba(20, 12, 30, .4), 0 0 22px rgba(106, 53, 173, .55); }
  .course:hover::before { transform: scaleX(1); }
  .course:hover .course-go { background: var(--accent); border-color: var(--accent); color: var(--bg); transform: rotate(-45deg); }
  .book:hover .book-cover { transform: rotateY(-8deg) translateX(4px); }
}

/* ───────── Responsive ───────── */
@media (max-width: 1000px) {
  .tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .places { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .place:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .sec-grid { grid-template-columns: minmax(0, 1fr); }
  .sec-head { position: static; }
  .featured { grid-template-columns: minmax(0, 1fr); }
  .feat { min-height: 0; }
  .feat-foot { margin-top: .25rem; }
}

@media (max-width: 1100px) {
  :root { --nav-h: 104px; }
  html { scroll-padding-top: 4.5rem; }
  /* Khi cuộn, hàng tên trôi đi, chỉ giữ hàng mục lục để nhường chỗ cho nội dung. */
  .nav { top: -56px; }
  .nav-inner { flex-wrap: wrap; gap: 0 1rem; align-content: center; }
  .brand { order: 1; height: 50px; }
  .lang { order: 2; margin-left: auto; }
  .theme-btn { order: 3; }
  .nav-links {
    order: 4; width: calc(100% + var(--gutter) * 2); margin: 0 calc(var(--gutter) * -1);
    padding-inline: calc(var(--gutter) - .75rem); padding-bottom: 2px;
    overflow-x: auto; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-indicator { bottom: 0; }
}

@media (max-width: 1100px) {
  .stats.has-metrics { grid-template-columns: repeat(3, 1fr); }
  .stats.has-metrics .stat:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
  .stats.has-metrics .stat:nth-child(n + 4) { border-top: 1px solid var(--rule); }
}

@media (max-width: 820px) {

  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-top: 2rem; }
  .hero-name { font-size: clamp(2.25rem, 10.5vw, 3rem); }
  .portrait { justify-self: center; width: min(86%, 400px); margin-top: 1.5rem; }
  .stats, .stats.has-metrics { grid-template-columns: repeat(2, 1fr); }
  .stats.has-metrics .stat:nth-child(3n + 1) { border-left: 1px solid var(--rule); padding-left: 1rem; }
  .stats.has-metrics .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat, .stat:first-child { padding: 1.1rem 1rem 1.2rem; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
  .stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stat:nth-child(-n+2) { border-top: 0; }

  .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .pub-year { grid-template-columns: minmax(0, 1fr); }
  .pub-year-label { position: static; display: flex; align-items: baseline; gap: .6rem; }
  .pub-year-label small { margin: 0; }
  .search { max-width: none; flex-basis: 100%; }
}

@media (max-width: 720px) {
  .model-stage canvas { aspect-ratio: 1; }
  .tasks { grid-template-columns: minmax(0, 1fr); }
  .task-card { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: .75rem; align-items: center; padding-bottom: .5rem; }
  .task-text { margin-top: 0; padding-inline: 0; }
  .pano { --px: 40%; }
  .pano-box { display: none; }
  .pano-credit { left: var(--gutter); right: auto; }
  .pano-text { bottom: 2rem; }
  .places { grid-template-columns: minmax(0, 1fr); }
  .bg-cols { grid-template-columns: minmax(0, 1fr); }
  .hist-years span:nth-child(odd) { visibility: hidden; }
  .apps { grid-template-columns: minmax(0, 1fr); }
  .places-sec .sec-head { display: block; }
  .places-sec .sec-note { margin-top: .75rem; }
  .model-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .task-chip b { display: none; }
  .nav-inner { column-gap: .5rem; }
  .brand { gap: .4rem; font-size: .875rem; }
  .brand-mark { width: 15px; height: 15px; }
  .lang a { min-width: 1.75rem; padding-inline: .2rem; }
  .theme-btn { width: 34px; height: 34px; }
}

@media (max-width: 480px) {
  .course { grid-template-columns: minmax(0, 1fr) auto; padding-inline: 0; }
  .course-no { display: none; }
  .book { grid-template-columns: minmax(0, 1fr); }
  .tl { padding-left: 1.5rem; }
  .bbox-label { font-size: .625rem; }
}

/* ───────── Họa tiết Huế: tự vẽ, dùng làm mask để đổi màu theo theme ───────── */
:root {
  --motif: #a67c2d;
  --m-fret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke-width='1.6' stroke-linecap='square' d='M0 14.5H32M24 14.5V2H6V10H17V6H11'/%3E%3C/g%3E%3C/svg%3E");
  --m-lotus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke-width='2.6'%3E%3Cpath d='M50 80C34 80 14 72 6 50C20 48 34 54 42 66'/%3E%3Cpath d='M50 80C36 66 22 46 24 26C34 30 42 38 46 48'/%3E%3Cg transform='matrix%28-1 0 0 1 100 0%29'%3E%3Cpath d='M50 80C34 80 14 72 6 50C20 48 34 54 42 66'/%3E%3Cpath d='M50 80C36 66 22 46 24 26C34 30 42 38 46 48'/%3E%3C/g%3E%3Cpath d='M50 80C38 62 38 34 50 12C62 34 62 62 50 80Z'/%3E%3Cpath d='M50 80V36'/%3E%3Cpath d='M22 90C36 84 64 84 78 90'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --m-cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 80'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke-width='2.2'%3E%3Cpath d='M44 37C49 33 54 39 50 44C44 50 33 45 35 35C37 23 53 19 62 29C65 15 90 12 98 26C103 36 95 45 86 42C80 39 81 31 87 31'/%3E%3Cpath d='M34 46C50 63 80 50 106 54C124 57 136 66 154 60'/%3E%3Cpath d='M50 58C64 68 84 62 102 66C112 68 120 72 130 72'/%3E%3Cpath d='M98 26C112 22 124 30 122 40C121 46 114 48 110 44'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --m-waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 36'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke-width='1.4'%3E%3Cpath d='M0 8C10 2 30 2 40 8S70 14 80 8'/%3E%3Cpath d='M0 18C10 24 30 24 40 18S70 12 80 18'/%3E%3Cpath d='M0 28C10 22 30 22 40 28S70 34 80 28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
/* Dải hồi văn ở cuối phần đầu trang */
.hero::after {
  content: ''; display: block; height: 20px;
  background: var(--motif); opacity: .85;
  -webkit-mask: var(--m-fret) left center / 40px 20px repeat-x;
  mask: var(--m-fret) left center / 40px 20px repeat-x;
}
/* Hoa sen nhỏ trước số thứ tự mỗi mục */
.sec-no::before {
  content: ''; display: inline-block; width: 20px; height: 20px; margin-right: .4rem; vertical-align: -5px;
  background: var(--motif);
  -webkit-mask: var(--m-lotus) center / contain no-repeat;
  mask: var(--m-lotus) center / contain no-repeat;
}
/* Họa tiết lớn, rất nhạt, đặt ở khoảng trống của cột tiêu đề */
#background::after, #teaching::after, #projects::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  left: max(var(--gutter), calc(50% - 620px + var(--gutter)));
  background: var(--motif); opacity: .34;
}
#background::after {
  bottom: 1.5rem; width: min(190px, 19vw); height: min(190px, 19vw);
  -webkit-mask: var(--m-lotus) left bottom / contain no-repeat;
  mask: var(--m-lotus) left bottom / contain no-repeat;
}
#teaching::after, #projects::after {
  width: min(280px, 24vw); height: min(140px, 12vw);
  -webkit-mask: var(--m-cloud) left center / contain no-repeat;
  mask: var(--m-cloud) left center / contain no-repeat;
}
#teaching::after { top: 42%; }
#projects::after { top: 40%; }
/* Sóng sông Hương trôi rất chậm ở đầu khối liên hệ */
.contact::before {
  content: ''; position: absolute; left: 0; top: 0; height: 36px; width: calc(100% + 80px); pointer-events: none;
  background: var(--motif); opacity: .75;
  -webkit-mask: var(--m-waves) left top / 80px 36px repeat-x;
  mask: var(--m-waves) left top / 80px 36px repeat-x;
  animation: riverDrift 14s linear infinite;
}
@keyframes riverDrift { to { transform: translateX(-80px); } }
/* Dải hồi văn mở đầu mục Huế */
#places::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 20px; pointer-events: none;
  background: var(--motif); opacity: .85;
  -webkit-mask: var(--m-fret) left center / 40px 20px repeat-x;
  mask: var(--m-fret) left center / 40px 20px repeat-x;
}
/* Một cột: bản nhỏ đặt ở góc phải, ngang hàng tiêu đề */
@media (max-width: 1000px) {
  #background::after, #teaching::after, #projects::after {
    left: auto; right: var(--gutter); bottom: auto; top: clamp(3rem, 8vw, 5rem);
    width: 76px; height: 76px; opacity: .4;
  }
  #teaching::after, #projects::after { width: 104px; height: 52px; top: clamp(3.5rem, 9vw, 5.5rem); }
}
/* Tiêu đề dài chiếm hết hàng: bỏ họa tiết để không chồng lên chữ */
@media (max-width: 480px) {
  #teaching::after { display: none; }
}
@media (max-width: 360px) {
  #background::after { display: none; }
}
@media print {
  #places::before, .more-btn, .hero-bridge, .hero::after, .sec-no::before, .contact::before, #background::after, #teaching::after, #projects::after { display: none !important; }
}

/* ───────── Giảm chuyển động ───────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .r { opacity: 1; transform: none; }
  .scanline { display: none; }
}

/* ───────── In ấn (xuất PDF làm CV) ───────── */
@media print {
  .apps-block, .pano, #places, #models, .portrait-3d, .portrait-tilt::before, .nav, .progress, .bg-lines, .bg-glow, .hero-grid, .scanline, .bbox, .hist, .hist-years, .pub-controls, .pub-panel .sub-title, .toast, .detector, .copy-btn, .pub-act[data-cite], .course-go, .hero-actions .btn, .foot a { display: none !important; }
  :root, :root[data-theme='dark'] { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --ink-3: #444; --rule: #ccc; --accent: #3e1e66; --accent-soft: #eee; --band: #fff; --band-ink: #000; --band-ink-2: #333; --band-rule: #ccc; --band-accent: #3e1e66; --tint: #fff; --sec-bg: #fff; }
  .book { background: none; padding: 0; }
  .js .r { opacity: 1 !important; transform: none !important; }
  .hero-name .line, .hero-enter, .pub, .portrait { animation: none !important; }
  .sec-head { position: static; }
  .sec { padding-block: 1.5rem; break-inside: auto; }
  .pub, .tl, .feat { break-inside: avoid; }
  .portrait { width: 120px; }
  .portrait-frame, .book-cover { box-shadow: none !important; }
  .hero-inner { padding-block: 0 1rem; }
  .hero-name { font-size: 3rem; margin: .5rem 0 .75rem; }
  .hero-name .line { display: inline; }
  .hero-name .line + .line { padding-left: .25em; }
}
