/* ============ HIỆU ỨNG ============ */
@media (max-width: 700px) { .hero .lamp { left: 76%; height: 18%; } }

/* Thanh tiến trình cuộn trang */
.progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; background: var(--o); transform-origin: 0 50%; transform: scaleX(0); z-index: 70; pointer-events: none; }

/* Con trỏ vòng tròn theo chuột (chỉ máy tính) */
.cursor { position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1px solid var(--o); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: width .3s, height .3s, margin .3s, background .3s, opacity .3s, border-color .3s; mix-blend-mode: normal; }
.cursor span { font: 600 11px/1 var(--display); color: #fff; text-transform: uppercase; letter-spacing: .06em; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.cursor.on { opacity: 1; }
.cursor.link { width: 56px; height: 56px; margin: -28px 0 0 -28px; background: color-mix(in srgb, var(--o) 18%, transparent); }
.cursor.view { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: var(--o); border-color: var(--o); }
.cursor.view span { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* Hero: chữ trồi lên từng dòng khi tải trang */
.js .hero h1 .a, .js .hero h1 .b { overflow: hidden; padding: .22em 0 .04em; margin-top: -.22em; }
.js .hero h1 i { display: block; font-style: normal; transform: translateY(105%); transition: transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.js .hero h1 .b i { transition-delay: .12s; }
.js .hero .in-1, .js .hero .in-3, .js .hero .in-4, .js .hero .scroll-hint { opacity: 0; transform: translateY(18px); transition: opacity .9s, transform .9s; }
.js .hero .in-3 { transition-delay: .35s; }
.js .hero .in-4 { transition-delay: .5s; }
.js .hero .scroll-hint { transition-delay: .8s; }
.ready .hero h1 i { transform: none; }
.ready .hero .in-1, .ready .hero .in-3, .ready .hero .in-4, .ready .hero .scroll-hint { opacity: 1; transform: none; }
.js .hero .scene { opacity: 0; transform: scale(1.06); transition: opacity 1.2s, transform 1.8s cubic-bezier(.2, .8, .2, 1); }
.ready .hero .scene { opacity: 1; transform: none; }

/* Đèn đung đưa nhẹ */
.motion .hero .lamp { animation: swing 6s ease-in-out infinite; }
@keyframes swing { 0%, 100% { rotate: -2.2deg; } 50% { rotate: 2.2deg; } }
.hero .scroll-hint:after { content: ""; display: block; width: 1px; height: 46px; background: currentColor; margin: 12px auto 0; transform-origin: top; animation: drip 2.2s ease-in-out infinite; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Tiêu đề lớn: từng chữ trồi lên */
.js [data-split] .wm { display: inline-block; overflow: hidden; vertical-align: top; padding: .28em 0 .08em; margin: -.28em 0 -.08em; }
.js [data-split] .wm > span { display: inline-block; transform: translateY(110%); transition: transform .9s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i) * 60ms); }
.js [data-split].in .wm > span { transform: none; }

/* Ảnh dự án mở màn kiểu rèm */
.js .proj .img { clip-path: inset(0 100% 0 0); transition: clip-path 1.2s cubic-bezier(.7, 0, .2, 1) .1s; }
.js .proj:nth-child(even) .img { clip-path: inset(0 0 0 100%); }
.js .proj.in .img { clip-path: inset(0 0 0 0); }
.proj .img .ghost { transition: transform .2s linear; }
.show .slides { cursor: zoom-in; }

/* Thẻ dịch vụ và học vấn */
.srail .col { transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.srail .col:hover { transform: translateY(-6px); }
.col h3 { background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .5s; display: inline; padding-bottom: 2px; }
.col:hover h3 { background-size: 100% 2px; }
.col h3 + p, .col h3 + .eorg { margin-top: 14px; }
.col li { transition: padding .3s, color .3s; }
.col li:hover { padding-left: 8px; color: var(--hl); }
.col li:after { transition: transform .3s; }
.col li:hover:after { transform: translate(3px, -3px); }

/* Menu: các mục trượt vào lần lượt */
.overlay nav a { opacity: 0; transform: translateY(30px); }
.menu-open .overlay nav a { opacity: 1; transform: none; transition: opacity .6s, transform .6s cubic-bezier(.2, .8, .2, 1), color .25s; }
.menu-open .overlay nav a:nth-child(1) { transition-delay: .08s; }
.menu-open .overlay nav a:nth-child(2) { transition-delay: .14s; }
.menu-open .overlay nav a:nth-child(3) { transition-delay: .2s; }
.menu-open .overlay nav a:nth-child(4) { transition-delay: .26s; }
.menu-open .overlay nav a:nth-child(5) { transition-delay: .32s; }
.menu-open .overlay nav a:nth-child(6) { transition-delay: .38s; }
.menu-open .overlay nav a:hover { transform: translateX(10px); transition-delay: 0s; }
.overlay aside { opacity: 0; transition: opacity .6s .3s; }
.menu-open .overlay aside { opacity: 1; }

/* Hiện dần: thêm độ trễ cho các mục liền nhau */
.tl .it.rv:nth-child(2) { transition-delay: .06s; }
.tl .it.rv:nth-child(3) { transition-delay: .12s; }
.tl .it.rv:nth-child(4) { transition-delay: .18s; }

/* Nút: bóng sáng lướt qua */
.btn { overflow: visible; }
.btn.solid { background-image: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); background-size: 250% 100%; background-position: 150% 0; }
.btn.solid:hover { background-position: -50% 0; transition: background-position .8s, color .3s; }

/* CTA: dấu hỏi lơ lửng */
.motion .cta .band:before { animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-58%) rotate(6deg); } }

/* Đổi giao diện sáng tối: vòng tròn lan ra */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Ảnh chưa tải: nền nhấp nháy nhẹ */
.show .sl img:not([src]) { opacity: 0; }
.show .sl img { transition: opacity .5s; }

/* Học vấn: không có câu dẫn nên canh nhãn và nút ngang hàng */
.edu .shead { align-items: center; margin-bottom: 40px; }
.edu .shead .label { margin-bottom: 0; }

/* Học vấn: khóa giống Hành trình nghề nghiệp */
.ebox { position: relative; }
.ebox.is-locked .srail { filter: blur(8px); pointer-events: none; user-select: none; }
.ebox .gate { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; z-index: 3; }
.ebox.is-locked .gate { display: flex; }
.edu:has(.ebox.is-locked) .snav { opacity: .35; pointer-events: none; }

/* Thạc sĩ: nhấn nhẹ */
.srail .col.hl { border-top: 2px solid var(--o); background: linear-gradient(180deg, color-mix(in srgb, var(--o) 7%, transparent), transparent 70%); padding: 26px 20px 0; margin: 0 -4px; }
.col.hl h3 { color: var(--hl); }
.col .star { font: 600 11px/1 var(--display); color: var(--hl); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.col .star:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--o); box-shadow: 0 0 0 4px color-mix(in srgb, var(--o) 20%, transparent); }

.col .kind.act { color: var(--t); border-color: color-mix(in srgb, var(--tl) 60%, transparent); }
:root[data-theme="dark"] .col .kind.act, :root:not([data-theme]) .col .kind.act { color: var(--tl); }

/* Ô minh họa cao bằng cột chữ, không còn khoảng hở trên dưới */
@media (min-width: 861px) {
  .proj { align-items: stretch; }
  .proj .img { aspect-ratio: auto; height: auto; min-height: 380px; align-self: stretch; }
  .proj .txt { padding: 6px 0; display: flex; flex-direction: column; justify-content: center; }
}

/* Liên hệ: tiêu đề không tràn sang bản đồ, xếp dọc sớm hơn */
.contact h2 { font-size: clamp(32px, 3.6vw, 54px); }
@media (max-width: 1100px) { .contact .grid { grid-template-columns: 1fr; } .map { min-height: 340px; } }

/* Về mình: ảnh chân dung cao bằng cả cột chữ */
@media (min-width: 861px) {
  .about .grid { align-items: stretch; }
  .about .portrait { display: flex; flex-direction: column; margin: 0; }
  .about .portrait .ph { aspect-ratio: auto; flex: 1; min-height: 420px; }
}

/* Con trỏ: chấm tâm, vòng trễ, gợn sóng khi bấm, hòa màu trên tiêu đề */
.cursor-dot { position: fixed; left: 0; top: 0; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--o); z-index: 121; pointer-events: none; opacity: 0; transition: opacity .3s, width .25s, height .25s, margin .25s; }
.cursor-dot.on { opacity: 1; }
.cursor.link + .cursor-dot, .cursor.view + .cursor-dot { width: 0; height: 0; margin: 0; }
.cursor.title { width: 120px; height: 120px; margin: -60px 0 0 -60px; background: #ede6d1; border-color: transparent; mix-blend-mode: difference; }
.cursor.title + .cursor-dot { opacity: 0; }
.cursor.press { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.cursor.link.press { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
.ripple { position: fixed; z-index: 119; pointer-events: none; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 1px solid var(--o); border-radius: 50%; animation: ripple .7s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes ripple { to { transform: scale(9); opacity: 0; } }
@media (hover: none), (pointer: coarse) { .cursor-dot { display: none; } }

/* ===== Tối ưu điện thoại ===== */
/* Quầng sáng bóng đèn: dùng lớp gradient thay cho box-shadow để không bị cắt thành khung vuông */
.hero .scene .bulb { box-shadow: none; }
.hero .scene .bulb:after { content: ""; position: absolute; inset: -110%; border-radius: 50%; background: radial-gradient(circle, rgba(255,150,60,.32), rgba(255,150,60,.12) 35%, transparent 65%); pointer-events: none; }

/* Vùng bấm đủ lớn cho ngón tay */
.ask { min-height: 44px; }
.crow .acts a { min-width: 44px; justify-content: center; }
@media (max-width: 700px) {
  .theme { height: 42px; padding-left: 14px; }
  .menu-btn { width: 44px; height: 44px; }
  .top .wrap { height: 68px; }
  .hero .ctas .btn { flex: 1 1 140px; justify-content: center; }
  .hero .sub { font-size: 16px; }
  /* Tài liệu: gọn hơn trên màn nhỏ */
  .dl a { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; padding: 18px 2px; }
  .dl h3 { font-size: 17px; }
  .dl .lock { font-size: 0; padding: 0; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
  .dl .lock:before { content: ""; width: 10px; height: 8px; border: 1.5px solid var(--o); border-radius: 2px; margin-top: 6px; }
  .dl .lock:after { content: ""; position: absolute; top: 9px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border: 1.5px solid var(--o); border-bottom: 0; border-radius: 5px 5px 0 0; }
  .dlwin { height: 430px; }
  /* Thanh trượt dịch vụ, học vấn: thẻ rộng hơn, thấy mép thẻ kế tiếp */
  .srail .col { flex-basis: 82vw; }
  .shead { margin-bottom: 36px; }
  .gate .in { padding: 26px 20px; }
  .modal .panel { padding: 26px 20px; }
  .proj { padding: 44px 0; }
  .cta .btn { width: 100%; justify-content: center; }
}

/* ===== Giãn dòng tiêu đề: đủ chỗ cho dấu tiếng Việt chồng tầng ===== */
.hero h1 { line-height: 1.04; }
.hero h1 .b { margin-top: .02em; }
.projects .head h2, .docs h2, .cta h2, .profile .head h2, .contact h2 { line-height: 1.22; }
.contact h2 em, .contact h2 span { padding-top: .06em; }
.proj h3 { line-height: 1.2; }
.gate h3, .modal h3 { line-height: 1.2; }
.statement { line-height: 1.45; }
.skills h2 { line-height: 1.38; }
.col h3, .dl h3, .tl h3 { line-height: 1.35; }
.overlay nav a { line-height: 1.5; }
.marquee span { line-height: 1.2; }
.js [data-split] .wm { padding: .3em 0 .12em; margin: -.3em 0 -.12em; }

/* ===== Ảnh chân dung: khung lệch chỉ bao quanh ảnh, chú thích nằm ngoài ===== */
.about .portrait:before { display: none; }
.about .portrait .ph { box-shadow: 14px 14px 0 -1px var(--bg), 14px 14px 0 0 var(--hl); margin-right: 14px; overflow: hidden; }
.about .portrait figcaption { margin-top: 30px; }

/* ===== Tên dự án: nhỏ lại, ngắt dòng cân đối ===== */
.proj h3 { font-size: clamp(22px, 2.3vw, 32px); font-stretch: 108%; letter-spacing: -.01em; text-wrap: balance; }
@media (min-width: 861px) {
  .proj { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .proj:nth-child(even) { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}
@media (max-width: 700px) { .proj h3 { font-size: 24px; } }

/* ===== Con trỏ trên tiêu đề: quầng sáng gradient mềm thay cho vòng đảo màu ===== */
.cursor.title { width: 150px; height: 150px; margin: -75px 0 0 -75px; border-color: transparent; mix-blend-mode: normal;
  background: radial-gradient(circle, color-mix(in srgb, var(--o) 38%, transparent) 0%, color-mix(in srgb, var(--hl) 16%, transparent) 45%, transparent 70%);
  filter: blur(2px); }
:root[data-theme="dark"] .cursor.title, :root:not([data-theme]) .cursor.title { mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(255, 170, 90, .42) 0%, rgba(212, 199, 143, .16) 45%, transparent 70%); }
.proj h3 .tl-seg { display: block; text-wrap: balance; }

/* ===== Thẻ dịch vụ và học vấn: các phần thẳng hàng giữa các thẻ ===== */
.srail .col { display: flex; flex-direction: column; }
.col .n { min-height: 28px; flex-wrap: nowrap; white-space: nowrap; }
.col h3 { display: block; background: none; min-height: 2.7em; text-wrap: balance; }
.col:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.col .eorg { min-height: 2.9em; margin: 4px 0 6px; }
.col h3 + p, .col h3 + .eorg { margin-top: 12px; }
.col p { min-height: 6.8em; }
.col ul { margin-top: auto; }
@media (max-width: 700px) { .col p, .col .eorg { min-height: 0; } }

/* ===== Cột timeline: chấm và đường nối dọc ===== */
.tl .it { position: relative; grid-template-columns: 170px minmax(0, 1fr); }
.tl .when { position: relative; padding-left: 26px; }
.tl .when:before { content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--o); background: var(--bg); z-index: 1; }
.tl .it:first-child .when:before, .tl .it:nth-child(2) .when:before { background: var(--o); box-shadow: 0 0 0 5px color-mix(in srgb, var(--o) 18%, transparent); }
.tl .it:after { content: ""; position: absolute; left: 6.5px; top: 46px; bottom: -20px; width: 2px; background: color-mix(in srgb, var(--o) 30%, var(--line)); }
.tl .it:last-child:after { display: none; }
@media (max-width: 600px) {
  .tl .it { grid-template-columns: 1fr; padding-left: 26px; }
  .tl .when { padding-left: 0; position: static; }
  .tl .when:before { left: 0; top: 32px; }
  .tl .it:after { top: 52px; }
}

/* ===== Menu mở rộng: email nằm một dòng riêng, không bị ngắt ===== */
.overlay aside .wide { grid-column: 1 / -1; }
.overlay aside span { white-space: nowrap; }

/* Thẻ Thạc sĩ: nền nhấn nằm ngoài lề, không bóp hẹp chữ nên các dòng vẫn thẳng hàng với thẻ khác */
.srail .col.hl { padding: 26px 0 0; margin: 0; background: none; position: relative; isolation: isolate; }
.srail .col.hl:before { content: ""; position: absolute; inset: 0 -18px; z-index: -1; background: linear-gradient(180deg, color-mix(in srgb, var(--o) 8%, transparent), transparent 75%); }
