/* =========================================================
   Trang cá nhân — stylesheet
   Bảng màu, khoảng cách và bo góc đều là biến ở :root,
   đổi ở đó là đổi toàn trang.
   ========================================================= */

:root {
  --bg:            #0b1120;
  --bg-alt:        #0f172a;
  --surface:       #131c31;
  --surface-hi:    #1a2540;
  --border:        #223052;
  --text:          #e2e8f5;
  --text-muted:    #94a3c0;
  --accent:        #5eead4;
  --accent-strong: #2dd4bf;
  --accent-soft:   rgba(94, 234, 212, 0.12);
  --shadow:        0 18px 40px -18px rgba(0, 0, 0, 0.75);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --radius:    14px;
  --radius-sm: 8px;
  --container: 1120px;
  --header-h:  72px;
}

[data-theme='light'] {
  --bg:            #f8fafc;
  --bg-alt:        #eef2f8;
  --surface:       #ffffff;
  --surface-hi:    #f1f5fb;
  --border:        #d8e0ec;
  --text:          #16223a;
  --text-muted:    #55637d;
  --accent:        #0d9488;
  --accent-strong: #0f766e;
  --accent-soft:   rgba(13, 148, 136, 0.1);
  --shadow:        0 18px 40px -20px rgba(15, 33, 61, 0.22);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}

img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-strong); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: 12px; z-index: 200;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #04211d; font-weight: 600;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  backdrop-filter: blur(12px);
  transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom-color: var(--border);
  box-shadow: 0 6px 24px -18px rgba(0, 0, 0, .8);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.logo-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1.5px solid var(--accent); border-radius: var(--radius-sm);
  color: var(--accent); font-family: var(--font-mono); font-size: 17px;
  transition: transform .25s ease, background-color .25s ease;
}
.logo:hover .logo-mark { transform: rotate(-8deg); background: var(--accent-soft); }
.logo-text { font-family: var(--font-mono); font-size: 15px; letter-spacing: -.02em; }

.nav-list { display: flex; align-items: center; gap: 4px; }
.nav-list a {
  position: relative;
  display: block; padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14.5px; font-weight: 500;
}
.nav-list a:hover { color: var(--text); background: var(--surface-hi); }
.nav-list a.active { color: var(--accent); }
.nav-list a.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle-bar {
  width: 22px; height: 2px; border-radius: 2px;
  background: var(--text);
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded='true'] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded='true'] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
  display: grid; place-items: center;
  min-width: 38px; height: 38px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  letter-spacing: .04em;
  transition: border-color .2s ease, background-color .2s ease;
}
.lang-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .2s ease, background-color .2s ease;
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle svg {
  width: 18px; height: 18px;
  fill: none; stroke: var(--accent); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
[data-theme='dark']  .icon-sun  { display: none; }
[data-theme='light'] .icon-moon { display: none; }

.scroll-progress {
  position: absolute; bottom: -1px; left: 0;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--header-h) + 48px) 0 96px;
  overflow: hidden;
}
.hero-glow {
  position: absolute; top: -20%; left: 50%; translate: -50% 0;
  width: 900px; height: 900px; max-width: 140vw;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 62%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid; grid-template-columns: 1.15fr .85fr;
  gap: 56px; align-items: center;
}
/* min-width: 0 để khối code không đẩy rộng grid track */
.hero-text, .hero-card { min-width: 0; }

.hero-eyebrow {
  color: var(--accent);
  font-family: var(--font-mono); font-size: 15px;
  margin-bottom: 14px;
}
.hero-name {
  font-size: clamp(2.4rem, 6.5vw, 4.2rem);
  font-weight: 700; line-height: 1.08; letter-spacing: -.03em;
  margin-bottom: 8px;
}
.hero-role {
  min-height: 2.1em;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  font-weight: 600; color: var(--text-muted);
  margin-bottom: 18px;
}
.typed::after {
  content: '';
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.hero-desc {
  max-width: 52ch;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 26px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #04211d; }
.btn-primary:hover { background: var(--accent-strong); color: #04211d; transform: translateY(-2px); }
.btn-ghost { border-color: var(--accent); color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); transform: translateY(-2px); }
.btn-lg { padding: 15px 38px; font-size: 16px; }

.hero-social { display: flex; gap: 10px; }
.hero-social a {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 50%;
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}
.hero-social a:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--accent-soft); }
.hero-social svg { width: 18px; height: 18px; fill: var(--accent); }

/* Cửa sổ code trang trí */
.code-window {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
  transition: transform .4s ease;
}
.code-window:hover { transform: perspective(1000px) rotateY(0) rotateX(0); }
.code-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hi);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f57; } .dot-yellow { background: #febc2e; } .dot-green { background: #28c840; }
.code-file {
  margin-left: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 12.5px;
}
.code-body {
  padding: 20px;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.85;
  overflow-x: auto;
}
.c-key  { color: #c084fc; }
.c-var  { color: #60a5fa; }
.c-prop { color: var(--accent); }
.c-str  { color: #fca5a5; }
.c-bool { color: #fbbf24; }
[data-theme='light'] .c-key { color: #7c3aed; }
[data-theme='light'] .c-var { color: #1d4ed8; }
[data-theme='light'] .c-str { color: #b91c1c; }
[data-theme='light'] .c-bool { color: #b45309; }

.scroll-hint {
  position: absolute; bottom: 30px; left: 50%; translate: -50% 0;
  display: grid; place-items: center;
  width: 26px; height: 42px;
  border: 1.5px solid var(--border); border-radius: 14px;
}
.scroll-hint span {
  width: 4px; height: 8px; border-radius: 2px;
  background: var(--accent);
  animation: scroll-dot 1.6s ease-in-out infinite;
}
@keyframes scroll-dot {
  0%, 100% { transform: translateY(-6px); opacity: .4; }
  50%      { transform: translateY(6px);  opacity: 1; }
}

/* ---------- Khung section ---------- */
.section { padding: 104px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  display: flex; align-items: center; gap: 12px;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 14px;
}
.section-title::after {
  content: '';
  flex: 1; height: 1px; max-width: 260px;
  background: var(--border);
}
.section-title.center { justify-content: center; }
.section-title.center::after { display: none; }
.section-num {
  color: var(--accent);
  font-family: var(--font-mono); font-size: .68em; font-weight: 500;
}
.section-lead { max-width: 62ch; color: var(--text-muted); margin-bottom: 44px; }
.section-title + .about-grid,
.section-title + .skills-grid,
.section-title + .timeline { margin-top: 44px; }

/* ---------- Giới thiệu ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: start; }
.about-text p { color: var(--text-muted); margin-bottom: 16px; }

.fact-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin-top: 28px;
}
.fact-list li {
  padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
.fact-list strong {
  display: block;
  color: var(--text-muted);
  font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 3px;
}
.fact-list span { font-size: 15px; font-weight: 600; }

.photo-frame { position: relative; border-radius: var(--radius); }
.photo-frame::after {
  content: '';
  position: absolute; inset: 14px -14px -14px 14px;
  border: 1.5px solid var(--accent); border-radius: var(--radius);
  z-index: -1;
  transition: inset .3s ease;
}
.photo-frame:hover::after { inset: 8px -8px -8px 8px; }
.photo-frame img, .photo-placeholder {
  width: 100%; aspect-ratio: 1;
  border: 1px solid var(--border); border-radius: var(--radius);
  object-fit: cover;
}
.photo-placeholder {
  display: grid; place-items: center; gap: 8px; align-content: center;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: 13px;
}
.photo-placeholder svg { width: 54px; height: 54px; fill: var(--border); }

/* ---------- Kỹ năng ---------- */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.card {
  padding: 28px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.card-desc { color: var(--text-muted); font-size: 14.5px; margin-bottom: 18px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list li {
  padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font-mono); font-size: 12.5px;
}
.tag-list.small li { font-size: 11.5px; padding: 3px 10px; }

/* ---------- Dự án ---------- */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.project {
  display: flex; flex-direction: column;
  padding: 28px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.project:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.project-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.project-icon { width: 38px; height: 38px; fill: var(--accent); }
.project-links { display: flex; gap: 12px; }
.project-links svg { width: 19px; height: 19px; fill: var(--text-muted); transition: fill .2s ease; }
.project-links a:hover svg { fill: var(--accent); }
.project h3 { font-size: 1.2rem; margin-bottom: 10px; }
.project p { flex: 1; color: var(--text-muted); font-size: 14.5px; margin-bottom: 18px; }

/* ---------- Kinh nghiệm ---------- */
.timeline { position: relative; padding-left: 8px; }
.timeline::before {
  content: '';
  position: absolute; top: 8px; bottom: 8px; left: 8px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding: 0 0 40px 34px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; top: 7px; left: 0;
  width: 17px; height: 17px;
  border: 2.5px solid var(--accent); border-radius: 50%;
  background: var(--bg-alt);
}
.timeline-date {
  color: var(--accent);
  font-family: var(--font-mono); font-size: 13px;
  margin-bottom: 4px;
}
.timeline-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.timeline-body .at { color: var(--text-muted); font-weight: 400; }
.timeline-body .company { color: var(--accent); }
.timeline-body p:last-child { color: var(--text-muted); font-size: 14.5px; max-width: 68ch; }

/* Logo công ty / trường.
   Nền luôn sáng vì logo hãng đều là màu đặc, đặt trên nền tối sẽ bị chìm.
   Trạng thái ẩn ở đây, còn lúc hiện do .timeline-item.visible điều khiển
   (class 'visible' do IntersectionObserver trong script.js gắn vào). */
.org-logo {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; min-width: 104px; padding: 7px 14px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(10px) scale(.94);
  filter: blur(6px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.21, .9, .3, 1), filter .7s ease;
  /* Logo hiện sau phần chữ một nhịp cho đỡ dồn cục. */
  transition-delay: .12s;
}
.timeline-item.visible .org-logo {
  opacity: 1;
  transform: none;
  filter: none;
}
.org-logo img {
  display: block;
  height: 100%; width: auto; max-width: 168px;
  object-fit: contain;
}
/* File SVG của FPT có nhiều khoảng trắng trong viewBox, để padding như
   mặc định thì chữ nhìn bé hơn hai logo còn lại. Cho ăn hết chiều cao hộp. */
.org-logo--tight { padding: 0 10px; }
.org-logo--tight img { max-width: 190px; }

/* Chip chữ, dùng khi không có file logo hoặc ảnh lỗi. */
.org-logo--mono {
  background: var(--surface-hi);
  color: var(--accent);
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  letter-spacing: .02em;
}

/* ---------- Liên hệ ---------- */
.contact-inner { text-align: center; max-width: 640px; }
.contact-lead { color: var(--text-muted); margin: 0 auto 34px; }
.contact-list {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 40px;
  margin-top: 48px;
}
.contact-list li { display: grid; gap: 2px; }
.contact-label {
  color: var(--text-muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
}
.contact-list a { font-size: 14.5px; font-weight: 500; word-break: break-all; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px;
  color: var(--text-muted); font-size: 13.5px;
}
.to-top { font-family: var(--font-mono); font-size: 13px; }

/* ---------- Hiệu ứng xuất hiện khi cuộn ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner, .about-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero { padding-bottom: 72px; }
  .code-window { transform: none; }
  .about-photo { max-width: 320px; }
  .photo-frame::after { inset: 12px -12px -12px 12px; }
  .section { padding: 80px 0; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-list {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 14px 24px 22px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-130%);
    visibility: hidden;
    transition: transform .3s ease, visibility .3s ease;
  }
  .nav-list.open { transform: none; visibility: visible; }
  .nav-list a { padding: 12px 6px; font-size: 16px; }
  .nav-list a.active::after { left: 6px; right: auto; width: 18px; }
  .scroll-hint { display: none; }
  .fact-list { grid-template-columns: 1fr; }
  .section-title::after { max-width: 80px; }
}

@media (max-width: 420px) {
  .container { padding-inline: 18px; }
  .hero-actions .btn { flex: 1; }
}

/* ---------- Tôn trọng lựa chọn giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .org-logo { opacity: 1; transform: none; filter: none; }
}

/* ---------- In ra giấy / xuất PDF ---------- */
@media print {
  .site-header, .scroll-hint, .hero-social, .to-top, .theme-toggle, .lang-toggle { display: none; }
  body { background: #fff; color: #000; }
  .section { padding: 24px 0; page-break-inside: avoid; }
  .reveal { opacity: 1; transform: none; }
  .org-logo { opacity: 1; transform: none; filter: none; border-color: #ccc; }
}
