/* KhanhHung.net — design tokens & base
   Dark, high-tech, Linear/Vercel-adjacent. Mobile-first. */

:root {
  --bg: #070b14;
  --bg-elev: #0b1220;
  --bg-card: #101826;
  --bg-card-hover: #142033;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #7b8ba3;
  --accent: #22d3ee;
  --accent-deep: #0891b2;
  --accent-2: #60a5fa;
  --emerald: #34d399;
  --on-accent: #04262b;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --glow: rgba(34, 211, 238, 0.22);
  --glow-blue: rgba(96, 165, 250, 0.16);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --container: 1120px;
  --gutter: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

button,
.btn,
summary {
  cursor: pointer;
}

a:hover {
  color: #67e8f9;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.section {
  padding: 72px 0;
}

.section-head {
  max-width: 640px;
  margin-bottom: 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--text);
}

h1 {
  font-size: clamp(2.05rem, 6vw, 3.6rem);
  font-weight: 600;
}

h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.15rem);
  font-weight: 600;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: 1.0625rem;
  max-width: 42rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  color: var(--accent);
  overflow-wrap: anywhere;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: background 180ms var(--ease), border-color 180ms var(--ease),
    box-shadow 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3), 0 10px 30px rgba(34, 211, 238, 0.18);
}

.btn-primary:hover {
  background: #67e8f9;
  color: var(--on-accent);
  box-shadow: 0 0 24px var(--glow);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(15, 23, 42, 0.4);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 24px var(--glow);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  border-bottom: 1px solid transparent;
  background: rgba(7, 11, 20, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

.site-header,
.header-inner {
  position: relative;
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
  background: rgba(7, 11, 20, 0.92);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--text);
}

.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 4px;
}

.nav-desktop a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 8px;
}

.nav-desktop a:hover,
.nav-desktop a.is-active {
  color: var(--text);
}

.nav-cta {
  display: none;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.icon-close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.nav-mobile {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  border-top: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.98);
  padding: 12px 0 20px;
  box-shadow: var(--shadow);
}

.nav-mobile.is-open {
  display: block;
}

.nav-mobile a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.nav-mobile a:hover {
  color: var(--accent);
}

body.menu-open {
  overflow: hidden;
}

/* Hero */
.hero {
  position: relative;
  padding: 48px 0 32px;
  isolation: isolate;
}

.hero-grid {
  display: grid;
  gap: 36px;
  align-items: center;
}

.hero-copy h1 {
  margin-bottom: 16px;
}

.hero-visual {
  position: relative;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(34, 211, 238, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(52, 211, 153, 0.1), transparent 46%),
    linear-gradient(180deg, #0d1628 0%, #070b14 100%);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-visual svg {
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.pulse-node {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 4.5s var(--ease) infinite;
}

.scan-line {
  animation: scan 8s linear infinite;
  opacity: 0.35;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes scan {
  from {
    transform: translateY(-40px);
  }
  to {
    transform: translateY(40px);
  }
}

.grid-bg {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 72%);
}

/* About */
.about-grid {
  display: grid;
  gap: 28px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stat {
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat-label {
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Cards */
.card-grid {
  display: grid;
  gap: 14px;
}

.card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease),
    background 200ms var(--ease), transform 200ms var(--ease);
}

.card:hover {
  border-color: rgba(34, 211, 238, 0.45);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.08), 0 18px 40px rgba(8, 145, 178, 0.08);
}

.card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 238, 0.06);
  color: var(--accent);
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card p {
  font-size: 0.95rem;
}

.card-meta {
  margin-top: 14px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--emerald);
}

/* Projects */
.project {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.project-index {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.project h3 {
  margin-bottom: 8px;
}

/* Insights */
.insight-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.insight {
  display: grid;
  gap: 8px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 180ms var(--ease);
}

.insight:hover h3 {
  color: var(--accent);
}

.insight:hover {
  color: inherit;
}

.insight-kicker {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Contact */
.contact-panel {
  display: grid;
  gap: 20px;
  padding: 28px 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(34, 211, 238, 0.08), transparent 50%),
    var(--bg-card);
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(7, 11, 20, 0.45);
}

.contact-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.contact-label svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.contact-value {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.contact-value.is-pending {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: default;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Motion */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: none;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
    --header-h: 72px;
  }

  .section {
    padding: 96px 0;
  }

  .nav-desktop,
  .nav-cta {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }

  .nav-mobile {
    display: none !important;
  }

  .hero {
    padding: 72px 0 48px;
  }

  .hero-grid,
  .about-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 48px;
    align-items: center;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-visual,
  .hero-visual svg {
    min-height: 380px;
  }
}

@media (min-width: 1024px) {
  .card-grid.expertise {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-grid.projects {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .contact-panel {
    grid-template-columns: 1.1fr 0.9fr;
    padding: 40px;
    align-items: center;
  }
}

@media (min-width: 1440px) {
  :root {
    --container: 1180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Portrait hero override */
.hero-visual img {
  width: 100%;
  height: 100%;
  min-height: 360px;
  max-height: 620px;
  object-fit: cover;
  object-position: center 22%;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(7, 11, 20, .78) 100%);
}
.hero-visual-badge {
  position: absolute;
  z-index: 2;
  left: 18px;
  bottom: 16px;
  padding: 7px 10px;
  border: 1px solid rgba(34, 211, 238, .35);
  border-radius: 999px;
  background: rgba(7, 11, 20, .72);
  color: var(--accent);
  font: 600 11px/1 var(--font-display);
  letter-spacing: .12em;
  backdrop-filter: blur(10px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
