:root {
  --bg: #05060f;
  --bg-2: #0a0d1f;
  --surface: rgba(18, 22, 48, 0.55);
  --surface-solid: #0f1330;
  --text: #e6e9ff;
  --muted: #8b91b8;
  --cyan: #22e4ff;
  --violet: #9b5cff;
  --pink: #ff4fd8;
  --accent: var(--cyan);
  --border: rgba(120, 140, 255, 0.16);
  --border-strong: rgba(34, 228, 255, 0.45);
  --grad: linear-gradient(120deg, var(--cyan), var(--violet) 55%, var(--pink));
  --radius: 18px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(155, 92, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(34, 228, 255, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; }
::selection { background: var(--violet); color: #fff; }
.mono { font-family: var(--mono); }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.gradient-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Nền */
#net { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 6vw;
  background: rgba(5, 6, 15, 0.6);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: var(--mono); font-weight: 500; text-decoration: none; font-size: 1.05rem; }
.brand span { color: var(--cyan); }
.nav nav { display: flex; gap: 26px; align-items: center; }
.nav nav a { text-decoration: none; color: var(--muted); font-size: 0.92rem; transition: color 0.2s; }
.nav nav a .mono { color: var(--cyan); font-size: 0.8rem; }
.nav nav a:hover { color: var(--text); }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1rem;
}

/* Hero */
.hero {
  overflow-x: clip;
  display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px;
  max-width: 1200px; margin: 0 auto; padding: 60px 6vw 40px; min-height: calc(100vh - 70px);
}
.hello { margin: 0 0 10px; color: var(--cyan); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan); animation: pulse 1.8s infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 5rem); font-weight: 800; margin: 0 0 14px; letter-spacing: -0.02em;
  filter: drop-shadow(0 0 30px rgba(155, 92, 255, 0.35));
}
.typing { font-size: clamp(1rem, 2vw, 1.25rem); color: var(--text); margin: 0 0 18px; min-height: 1.7em; }
.caret {
  display: inline-block; width: 0.6em; height: 1.1em; margin-left: 3px; vertical-align: -0.18em;
  background: var(--cyan); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.lead { color: #c4c9ee; max-width: 540px; margin: 0 0 10px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px; text-decoration: none; font-weight: 600;
  background: var(--grad); color: #fff; box-shadow: 0 0 30px rgba(155, 92, 255, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 45px rgba(34, 228, 255, 0.55); }
.btn.ghost { background: transparent; border: 1px solid var(--border-strong); box-shadow: none; color: var(--cyan); }
.btn.ghost:hover { background: rgba(34, 228, 255, 0.08); }
.stats { display: flex; gap: 34px; margin-top: 38px; }
.stats div { border-left: 2px solid var(--violet); padding-left: 14px; }
.stats strong { display: block; font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stats span { font-size: 0.82rem; color: var(--muted); font-family: var(--mono); }

/* Ảnh đại diện hoà vào nền */
.hero-visual {
  position: relative; display: grid; place-items: center;
  width: 100%; max-width: 540px; aspect-ratio: 4 / 5; justify-self: center;
}
/* Ảnh đã tách nền: người đứng trước các vòng neon, phần chân mờ dần vào nền */
.avatar {
  position: absolute; z-index: 2; bottom: 0; left: 50%; transform: translateX(-50%);
  height: 100%; width: auto; max-width: none;
  filter: drop-shadow(0 0 18px rgba(155, 92, 255, 0.55)) drop-shadow(0 0 40px rgba(34, 228, 255, 0.18));
}
.glow {
  position: absolute; z-index: 0; width: 90%; aspect-ratio: 1; left: 5%; top: 14%; border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 92, 255, 0.6), rgba(34, 228, 255, 0.16) 50%, transparent 70%);
  filter: blur(30px); animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.08); opacity: 0.8; } }
.ring {
  position: absolute; z-index: 1; border-radius: 50%; pointer-events: none;
  aspect-ratio: 1; border: 2px solid transparent;
}
.r1 {
  width: 86%; left: 7%; top: 16%;
  border-top-color: var(--cyan); border-right-color: rgba(34, 228, 255, 0.25);
  box-shadow: 0 0 30px rgba(34, 228, 255, 0.15), inset 0 0 30px rgba(34, 228, 255, 0.1);
  animation: spin 14s linear infinite;
}
.r2 {
  width: 100%; left: 0; top: 9%;
  border-bottom-color: var(--violet); border-left-color: rgba(155, 92, 255, 0.3);
  border-style: dashed; animation: spin 26s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sections */
.section { max-width: 1200px; margin: 0 auto; padding: 80px 6vw; }
.section h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 10px; font-weight: 700; }
.idx { color: var(--cyan); font-size: 0.55em; font-weight: 400; vertical-align: middle; margin-right: 6px; }
.sub { color: var(--violet); font-weight: 500; font-size: 1rem; margin: 44px 0 16px; letter-spacing: 0.05em; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 0 40px rgba(34, 228, 255, 0.08); }

/* About */
.about-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; margin-top: 28px; }
.about-grid p { color: #c4c9ee; }
.about-grid p:first-child { margin-top: 0; }
.about-grid p:last-child { margin-bottom: 0; }
.facts { list-style: none; margin: 0; display: grid; gap: 16px; }
.facts li { display: flex; gap: 14px; align-items: flex-start; }
.facts .ic {
  font-size: 1.1rem; width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 10px; background: rgba(155, 92, 255, 0.14); border: 1px solid rgba(155, 92, 255, 0.3);
}
.facts small { display: block; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  display: inline-block; padding: 6px 14px; border-radius: 8px; font-size: 0.85rem;
  font-family: var(--mono); color: var(--cyan);
  background: rgba(34, 228, 255, 0.07); border: 1px solid rgba(34, 228, 255, 0.25);
}
.tags.soft { margin-top: 12px; }
.tags.soft .tag { color: #d6b8ff; background: rgba(155, 92, 255, 0.08); border-color: rgba(155, 92, 255, 0.3); font-family: inherit; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--cyan), var(--violet), transparent);
}
.timeline li { position: relative; padding: 0 0 26px 34px; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--cyan); box-shadow: 0 0 12px var(--cyan);
}
.timeline .time { color: var(--cyan); font-family: var(--mono); font-size: 0.8rem; }
.timeline strong { display: block; font-size: 1.05rem; }

/* Projects */
.projects { display: grid; gap: 22px; margin-top: 28px; }
.project::before {
  content: ""; position: absolute; left: 0; top: 20px; bottom: 20px; width: 3px; border-radius: 3px;
  background: var(--grad);
}
.project-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.project h4 { margin: 0; font-size: 1.3rem; }
.project .time { color: var(--cyan); font-family: var(--mono); font-size: 0.82rem; }
.project .role { margin: 4px 0 10px; font-size: 0.92rem; }
.project p { color: #c4c9ee; }
.project .tags .tag { font-size: 0.75rem; padding: 3px 10px; }

/* Memories */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center;
  margin: 28px 0;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.88rem;
  transition: all 0.2s;
}
.filters button:hover { color: var(--text); border-color: var(--border-strong); }
.filters button.active { background: var(--grad); border-color: transparent; color: #fff; }
#search {
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 0.88rem; min-width: 260px;
}
#search:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 228, 255, 0.15); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.memory {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.memory:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 10px 50px rgba(155, 92, 255, 0.25); }
.memory .cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-2); }
.memory .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(5, 6, 15, 0.85));
}
.memory .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.memory:hover .cover img { transform: scale(1.06); }
.memory .count {
  position: absolute; right: 12px; top: 12px; z-index: 1; padding: 3px 10px; border-radius: 999px;
  background: rgba(5, 6, 15, 0.7); border: 1px solid var(--border); color: #fff; font-size: 0.78rem; font-family: var(--mono);
}
.memory .info { padding: 16px 20px 22px; }
.memory h4 { margin: 12px 0 4px; font-size: 1.12rem; }
.memory .meta { font-size: 0.82rem; color: var(--muted); font-family: var(--mono); }

/* Contact */
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.socials a {
  display: flex; gap: 10px; align-items: center; padding: 13px 24px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-weight: 500;
  transition: all 0.2s;
}
.socials a:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 30px rgba(34, 228, 255, 0.2); }
.footer { text-align: center; padding: 30px; border-top: 1px solid var(--border); font-size: 0.8rem; }

/* Modal */
dialog {
  width: min(960px, 94vw); max-height: 92vh; padding: 0; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text); overflow: auto;
  box-shadow: 0 0 80px rgba(155, 92, 255, 0.3);
}
dialog::backdrop { background: rgba(2, 3, 10, 0.85); backdrop-filter: blur(6px); }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.viewer { position: relative; background: #000; }
.viewer img { width: 100%; max-height: 64vh; object-fit: contain; margin: 0 auto; }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 1.6rem; line-height: 1;
  background: rgba(5, 6, 15, 0.6); color: #fff; border: 1px solid var(--border-strong);
}
.prev { left: 12px; }
.next { right: 12px; }
.thumbs { display: flex; gap: 8px; padding: 12px 20px 0; overflow-x: auto; }
.thumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer;
  opacity: 0.45; border: 2px solid transparent; flex-shrink: 0;
}
.thumbs img.active { opacity: 1; border-color: var(--cyan); }
.modal-body { padding: 16px 24px 26px; }
.modal-body h3 { margin: 12px 0 4px; font-size: 1.5rem; }
.modal-body #modalMeta { font-family: var(--mono); font-size: 0.85rem; }

/* Hiện dần khi cuộn */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s, transform 0.7s; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 30px; min-height: 0; gap: 10px; }
  .hero-visual { order: -1; max-width: 380px; }
  .hello, .hero-actions, .stats { justify-content: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .stats { gap: 20px; }
  .stats div { text-align: left; }
  .about-grid { grid-template-columns: 1fr; }
  .nav nav { gap: 14px; }
  .nav nav a .mono { display: none; }
  #search { min-width: 0; width: 100%; }
}
@media (max-width: 520px) {
  .nav { padding: 12px 4vw; }
  .nav nav { gap: 10px; font-size: 0.82rem; }
  .nav nav a { font-size: 0.82rem; }
  .brand { display: none; }
  .nav { justify-content: center; }
}
