/* ============ MÀU SẮC & BIẾN ============ */
:root {
  --bg: #f6f2ea;
  --bg-2: #efe8db;
  --card: #fffdf8;
  --ink: #1c1a17;
  --ink-2: #5b554c;
  --line: #ddd4c4;
  --accent: #c2410c;
  --accent-soft: #fde4d4;
  --radius: 18px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --bg-2: #1c1a17; --card: #201e1a;
    --ink: #f2ede4; --ink-2: #a8a091; --line: #34302a;
    --accent: #fb923c; --accent-soft: #3a2418;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --bg-2: #1c1a17; --card: #201e1a;
  --ink: #f2ede4; --ink-2: #a8a091; --line: #34302a;
  --accent: #fb923c; --accent-soft: #3a2418;
  color-scheme: dark;
}

/* ============ CƠ BẢN ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
main { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }
em { font-style: italic; color: var(--accent); }
mark { background: var(--accent-soft); color: inherit; padding: 0 .2em; border-radius: 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; color: var(--ink-2); font-weight: 600; }

/* ============ NÚT ============ */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  background: var(--ink); color: var(--bg);
  padding: .85em 1.5em; border-radius: 999px; border: 1px solid var(--ink);
  font: 600 .95rem var(--sans); cursor: pointer;
  transition: transform .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--small { padding: .55em 1.1em; font-size: .85rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn .i-sun { display: none; }
[data-theme="dark"] .icon-btn .i-sun { display: block; }
[data-theme="dark"] .icon-btn .i-moon { display: none; }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(24px, calc((100% - 1120px) / 2 + 24px));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-color: var(--line); }
.nav__logo { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 28px; font-size: .92rem; color: var(--ink-2); }
.nav__links a { position: relative; transition: color .2s; }
.nav__links a:hover, .nav__links a.active { color: var(--ink); }
.nav__links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.nav__actions { display: flex; gap: 10px; align-items: center; }

/* ============ HERO ============ */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center;
  padding: 72px 0 56px;
}
.hero__name { font-size: clamp(2.8rem, 7vw, 5.4rem); margin: .2em 0 .15em; letter-spacing: -.02em; }
.hero__role { font-size: 1.25rem; font-weight: 500; color: var(--ink-2); }
.hero__lead { margin: 1.2em 0 1.8em; max-width: 52ch; color: var(--ink-2); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__meta { list-style: none; display: flex; gap: 24px; flex-wrap: wrap; margin-top: 2em; font-size: .9rem; color: var(--ink-2); }
.hero__meta li { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }
.dot--live { box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

.hero__photo { position: relative; aspect-ratio: 4/5; max-width: 380px; justify-self: end; width: 100%; }
.hero__photo img, .photo-placeholder {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 200px 200px var(--radius) var(--radius);
}
.photo-placeholder {
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent) 0%, #7c2d12 100%);
  color: #fff; font: 700 5rem var(--serif); letter-spacing: -.04em;
}
.photo-badge {
  position: absolute; left: -24px; bottom: 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.08);
  display: flex; flex-direction: column; line-height: 1.2;
}
.photo-badge strong { font: 700 1.6rem var(--serif); color: var(--accent); }
.photo-badge span { font-size: .8rem; color: var(--ink-2); }

/* ============ STATS ============ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stat { padding: 28px 20px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font: 600 2.4rem var(--serif); }
.stat span { font-size: .85rem; color: var(--ink-2); }

/* ============ SECTION ============ */
.section { padding: 96px 0 0; }
.section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px; }
.section__num { font: 600 .9rem var(--sans); color: var(--accent); }
.section__head h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }

/* About */
.about__big { font: 400 clamp(1.4rem, 3vw, 2rem)/1.35 var(--serif); max-width: 28ch; margin-bottom: 32px; }
.about__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; color: var(--ink-2); }

/* Timeline */
.timeline { list-style: none; border-left: 2px solid var(--line); margin-left: 8px; }
.job { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 0 0 44px 32px; position: relative; }
.job::before {
  content: ""; position: absolute; left: -9px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.job__time { font-size: .88rem; font-weight: 600; color: var(--ink-2); padding-top: 2px; }
.job h3 { font-size: 1.35rem; margin-bottom: .5em; }
.job h3 span { font-family: var(--sans); font-weight: 400; font-size: 1rem; color: var(--ink-2); }
.job ul { padding-left: 1.1em; color: var(--ink-2); }
.job li { margin-bottom: .3em; }
.job li::marker { color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tags span, .chips span {
  font-size: .78rem; font-weight: 500;
  padding: .35em .85em; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
}

/* Projects */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.project {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .3s, box-shadow .3s;
}
.project:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0,0,0,.08); }
.project__cover { aspect-ratio: 16/10; display: flex; align-items: flex-end; padding: 18px; }
.project__cover span { font: 700 3rem var(--serif); color: rgba(255,255,255,.9); }
.c1 { background: linear-gradient(135deg, #c2410c, #f59e0b); }
.c2 { background: linear-gradient(135deg, #1e3a8a, #0ea5e9); }
.c3 { background: linear-gradient(135deg, #14532d, #84cc16); }
.project__body { padding: 22px; }
.project h3 { font-size: 1.2rem; margin-bottom: .4em; }
.project p { color: var(--ink-2); font-size: .94rem; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.skill-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.skill-group h3 { font-size: 1.15rem; margin-bottom: 18px; }
.skill-group h3.mt { margin-top: 26px; }
.bar { margin-bottom: 16px; font-size: .9rem; }
.bar span { display: block; margin-bottom: 6px; }
.bar i { display: block; height: 6px; border-radius: 6px; background: var(--bg-2); position: relative; overflow: hidden; }
.bar i::after {
  content: ""; position: absolute; inset: 0; width: var(--w, 0%);
  background: var(--accent); border-radius: 6px;
  transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Education */
.edu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.edu__item { border-top: 2px solid var(--ink); padding-top: 18px; }
.edu__year { font-size: .82rem; font-weight: 600; color: var(--accent); }
.edu__item h3 { font-size: 1.2rem; margin: .3em 0; }
.edu__item p { color: var(--ink-2); font-size: .92rem; }

/* Contact */
.contact {
  margin-top: 96px; padding: 64px 48px;
  background: var(--ink); color: var(--bg); border-radius: 28px;
}
.contact .eyebrow { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.contact__title { font-size: clamp(1.8rem, 4.5vw, 3.2rem); margin: .4em 0 1.2em; }
.contact__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.contact__card {
  border: 1px solid color-mix(in srgb, var(--bg) 20%, transparent);
  border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 4px;
  transition: background .2s, border-color .2s;
  overflow-wrap: anywhere;
}
.contact__card:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.contact__card small { font-size: .75rem; opacity: .7; text-transform: uppercase; letter-spacing: .12em; }
.contact__card strong { font-weight: 500; font-size: .95rem; }

.footer {
  max-width: 1120px; margin: 0 auto; padding: 40px 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .85rem; color: var(--ink-2);
}

/* ============ HIỆU ỨNG XUẤT HIỆN ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; gap: 40px; }
  .hero__photo { justify-self: center; max-width: 300px; order: -1; }
  .photo-badge { left: -12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .projects, .skills, .edu { grid-template-columns: 1fr; }
  .about__cols { grid-template-columns: 1fr; gap: 16px; }
  .contact__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  main { padding: 0 16px; }
  .nav { padding: 12px 16px; }
  .job { grid-template-columns: 1fr; gap: 4px; padding-left: 24px; }
  .contact { padding: 40px 22px; }
  .contact__grid { grid-template-columns: 1fr; }
  .section { padding-top: 72px; }
}

/* ============ IN RA PDF ============ */
@media print {
  :root { --bg: #fff; --card: #fff; --bg-2: #f3f3f3; --ink: #111; --ink-2: #444; --line: #ddd; }
  .nav, .hero__cta, .footer a, .photo-badge, .hero__meta .dot { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { font-size: 12px; }
  .hero { padding: 0 0 16px; grid-template-columns: 1fr 160px; }
  .hero__photo { max-width: 160px; }
  .section { padding-top: 28px; break-inside: avoid-page; }
  .project, .skill-group, .job, .edu__item { break-inside: avoid; box-shadow: none; }
  .project__cover { display: none; }
  .contact { background: none; color: var(--ink); padding: 0; margin-top: 28px; }
  .contact__card { border-color: var(--line); }
  .bar i::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
