/* ==========================================================================
   PHUC KA - Design System & Layout (Production)
   ========================================================================== */

/* ----- Theme: Light (mặc định) ----- */
:root {
  --color-primary: #b39aff;
  --color-primary-rgb: 179, 154, 255;
  --color-bg: #ffffffd0;
  --color-bg-elevated: #ffffff;
  --color-surface: rgba(0, 0, 0, 0.03);
  --color-border: rgba(139, 111, 255, 0.26);
  --color-text: #0f0f14;
  --color-text-muted: #5c5c6a;
  --overlay-img: linear-gradient(165deg, rgba(248, 248, 252, 0.15) 0%, rgba(248, 248, 252, 0.6) 50%, rgba(179, 154, 255, 0.22) 100%);
  --mesh-1: rgba(179, 154, 255, 0.16);
  --mesh-2: rgba(139, 111, 255, 0.08);
  --header-bg: rgba(248, 248, 252, 0.88);
  --loader-bg: #f8f8fc;
  --shadow-card: 0 8px 28px rgba(15, 15, 20, 0.08);
  --shadow-hover: 0 12px 36px rgba(var(--color-primary-rgb), 0.22);
}

/* ----- Theme: Dark (class trên html) ----- */
html.dark {
  --color-bg: #0a0a0f;
  --color-bg-elevated: #12121a;
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-border: rgba(179, 154, 255, 0.22);
  --color-text: #f5f5f7;
  --color-text-muted: #a1a1aa;
  --overlay-img: linear-gradient(165deg, rgba(10, 10, 15, 0.2) 0%, rgba(10, 10, 15, 0.7) 55%, rgba(179, 154, 255, 0.18) 100%);
  --mesh-1: rgba(179, 154, 255, 0.12);
  --mesh-2: rgba(139, 111, 255, 0.06);
  --header-bg: rgba(10, 10, 15, 0.82);
  --loader-bg: #0a0a0f;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 12px 40px rgba(var(--color-primary-rgb), 0.18);
}

/* ----- Design tokens ----- */
:root {
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --container-max: 1200px;
  --header-h: 72px;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --gap-xs: 0.5rem;
  --gap-sm: 1rem;
  --gap-md: 1.5rem;
  --gap-lg: 2rem;
  --gap-xl: 3rem;

  --section-py: 100px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --theme-transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  --glass-blur: 14px;

  --text-xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.78rem);
  --text-sm: clamp(0.84rem, 0.8rem + 0.25vw, 0.92rem);
  --text-base: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem);
  --text-lg: clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
  --text-h3: clamp(1.05rem, 0.95rem + 0.6vw, 1.2rem);
  --text-h2: clamp(1.65rem, 1.35rem + 1.4vw, 2.35rem);
  --text-h1: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);
  --text-hero-role: clamp(0.95rem, 0.85rem + 0.5vw, 1.15rem);

  --grid-card-min: 280px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  color-scheme: light dark;
  background-color: var(--color-bg);
  color: var(--color-text);
}

/* Tắt transition khi load - chống giật / delay */
html.preload,
html.preload *,
html.preload *::before,
html.preload *::after {
  transition: none !important;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Chỉ transition màu - đồng bộ toàn site */
body,
.glass,
.header,
.loader,
.footer,
.btn--outline,
.btn--ghost,
.nav__link,
.theme-toggle,
.nav__toggle,
.stat-card,
.pricing-card,
.contact-card,
.skill-card,
.project-featured,
.project-row,
.services__list li,
.hero__badge,
.section__title,
.section__desc,
.hero__subtitle {
  transition: var(--theme-transition);
}

body.no-scroll,
body.nav-open {
  overflow: hidden;
}

/* Ẩn nội dung khi loader — tránh CLS, fade-in sau khi loader biến mất */
body:not(.is-ready) .header,
body:not(.is-ready) main {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.is-ready .header,
body.is-ready main {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.7s ease 0.15s, visibility 0.7s ease 0.15s;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

main {
  width: 100%;
  overflow-x: hidden;
}

/* Mesh nền - không gây overflow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -12%, var(--mesh-1), transparent 68%),
    radial-gradient(ellipse 45% 35% at 100% 35%, var(--mesh-2), transparent 65%);
  pointer-events: none;
  z-index: -1;
}

/* ==========================================================================
   Layout: Container & Section
   ========================================================================== */
.container {
  width: min(var(--container-max), calc(100% - 32px));
  margin-inline: auto;
}

.section {
  width: 100%;
  padding-block: var(--section-py);
  position: relative;
}

.section__header {
  text-align: center;
  margin-bottom: var(--gap-xl);
  max-width: 720px;
  margin-inline: auto;
}

.section__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--gap-xs);
}

.section__title {
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section__desc {
  margin-top: var(--gap-sm);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.section__glow {
  position: absolute;
  width: min(280px, 50vw);
  height: min(280px, 50vw);
  top: 12%;
  left: 0;
  background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.08), transparent 70%);
  pointer-events: none;
}

.section__glow--right {
  left: auto;
  right: 0;
}

/* ==========================================================================
   Card system (đồng bộ)
   ========================================================================== */
.glass {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: var(--theme-transition), transform var(--transition);
}

.glass:hover {
  border-color: rgba(var(--color-primary-rgb), 0.42);
  box-shadow: var(--shadow-hover);
}

.card-grid {
  display: grid;
  gap: var(--gap-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-card-min)), 1fr));
  align-items: stretch;
}

/* ==========================================================================
   Images
   ========================================================================== */
.img-overlay {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.img-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay-img);
  pointer-events: none;
}

.img-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1.35rem;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn svg {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), #8b6fff);
  color: #0a0a0f;
  box-shadow: 0 4px 20px rgba(var(--color-primary-rgb), 0.35);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(var(--color-primary-rgb), 0.45);
}

.btn--outline {
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text);
}

.btn--outline:hover {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.08);
}

.btn--ghost {
  border-color: var(--color-border);
  color: var(--color-primary);
}

.btn--lg {
  padding: 0.9rem 1.6rem;
  font-size: var(--text-base);
}

.btn.is-ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent 70%);
  animation: ripple 0.45s ease forwards;
}

@keyframes ripple {
  from { opacity: 1; transform: scale(0); }
  to { opacity: 0; transform: scale(2.2); }
}

/* ==========================================================================
   Logo — 3 lớp glow (ring + blur + pulse), overflow visible
   ========================================================================== */
.logo-glow-stage {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}

.logo-glow-ring,
.logo-glow-blur,
.logo-glow-pulse {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* Lớp 1: vòng gradient quay — cyan / blue / purple */
.logo-glow-ring {
  inset: -6px;
  z-index: 0;
  background: conic-gradient(
    from 0deg,
    #22d3ee 0deg,
    #38bdf8 50deg,
    #3b82f6 110deg,
    #6366f1 170deg,
    #8b5cf6 230deg,
    #a78bfa 290deg,
    #22d3ee 360deg
  );
  -webkit-mask: radial-gradient(
    circle,
    transparent 62%,
    #000 64%,
    #000 100%
  );
  mask: radial-gradient(
    circle,
    transparent 62%,
    #000 64%,
    #000 100%
  );
  opacity: 0.95;
  animation: rotateGlow 2.2s linear infinite;
  will-change: transform;
}

/* Lớp 2: blur glow quay cùng tốc độ */
.logo-glow-blur {
  inset: -10px;
  z-index: -1;
  background: conic-gradient(
    from 90deg,
    rgba(34, 211, 238, 0.85),
    rgba(59, 130, 246, 0.75),
    rgba(139, 92, 246, 0.85),
    rgba(34, 211, 238, 0.85)
  );
  filter: blur(12px);
  opacity: 0.7;
  animation: rotateGlow 2.2s linear infinite;
  will-change: transform;
}

/* Lớp 3: pulse mềm bên ngoài */
.logo-glow-pulse {
  inset: -14px;
  z-index: -2;
  box-shadow:
    0 0 28px rgba(34, 211, 238, 0.45),
    0 0 48px rgba(59, 130, 246, 0.35),
    0 0 64px rgba(167, 139, 250, 0.3);
  animation: pulseGlow 1.8s ease-in-out infinite alternate;
}

.nav__logo-img {
  position: relative;
  z-index: 2;
  width: 40px;
  height: 40px;
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 14, 24, 0.4);
  box-shadow:
    0 4px 20px rgba(34, 211, 238, 0.18),
    0 4px 24px rgba(139, 92, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.5s ease;
  will-change: transform;
}

.nav__logo:hover .nav__logo-img {
  transform: scale(1.08);
  box-shadow:
    0 6px 32px rgba(34, 211, 238, 0.35),
    0 6px 36px rgba(139, 92, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.nav__logo:hover .logo-glow-ring {
  opacity: 1;
}

.nav__logo:hover .logo-glow-blur {
  opacity: 0.9;
  filter: blur(14px);
}

.nav__logo:hover .logo-glow-pulse {
  box-shadow:
    0 0 36px rgba(34, 211, 238, 0.55),
    0 0 56px rgba(59, 130, 246, 0.45),
    0 0 72px rgba(167, 139, 250, 0.4);
}

.nav__logo.is-reload .logo-glow-ring,
.nav__logo.is-reload .logo-glow-blur {
  animation-duration: 1.4s;
}

/* Loader — logo 96px, glow lớn hơn 14px mỗi bên */
.logo-glow-stage--loader {
  width: 96px;
  height: 96px;
  margin-inline: auto;
  animation: logoFloat 2.6s ease-in-out infinite;
}

.logo-glow-stage--loader .nav__logo-img {
  width: 96px;
  height: 96px;
}

.logo-glow-stage--loader .logo-glow-ring {
  inset: -14px;
  opacity: 1;
  -webkit-mask: radial-gradient(
    circle,
    transparent 66%,
    #000 68%,
    #000 100%
  );
  mask: radial-gradient(
    circle,
    transparent 66%,
    #000 68%,
    #000 100%
  );
}

.logo-glow-stage--loader .logo-glow-blur {
  inset: -16px;
  filter: blur(18px);
  opacity: 0.85;
}

.logo-glow-stage--loader .logo-glow-pulse {
  inset: -20px;
  box-shadow:
    0 0 40px rgba(34, 211, 238, 0.55),
    0 0 70px rgba(59, 130, 246, 0.45),
    0 0 90px rgba(167, 139, 250, 0.4);
}


@keyframes rotateGlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseGlow {
  from {
    opacity: 0.55;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ==========================================================================
   Loader
   ========================================================================== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: visible;
  pointer-events: auto;
  background: linear-gradient(
    165deg,
    rgba(8, 10, 20, 0.97) 0%,
    rgba(14, 18, 36, 0.98) 42%,
    rgba(6, 8, 16, 0.99) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 1;
  visibility: visible;
}

html:not(.dark) .loader {
  background: linear-gradient(
    165deg,
    rgba(248, 248, 252, 0.97) 0%,
    rgba(232, 236, 248, 0.98) 45%,
    rgba(244, 246, 252, 0.99) 100%
  );
}

.loader.is-exiting {
  animation: fadeOutLoader 0.85s ease forwards;
  pointer-events: none;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow: visible;
  will-change: opacity, transform;
}

.loader__logo {
  margin-bottom: var(--gap-md);
  overflow: visible;
  padding: 22px;
}

@media (max-width: 576px) {
  .logo-glow-stage--loader .logo-glow-blur {
    filter: blur(12px);
  }

  .loader__logo {
    padding: 16px;
  }
}

.loader__bar {
  width: min(220px, 72vw);
  height: 3px;
  margin-inline: auto;
  margin-bottom: var(--gap-sm);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

html:not(.dark) .loader__bar {
  background: rgba(10, 10, 15, 0.08);
}

.loader__bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22d3ee, #3b82f6, #a78bfa);
  animation: barFill 2.8s ease forwards;
}

.loader__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes barFill {
  to {
    width: 100%;
  }
}

@keyframes fadeOutLoader {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.98);
    visibility: hidden;
  }
}

/* ==========================================================================
   Cursor glow (desktop only)
   ========================================================================== */
.cursor-glow {
  position: fixed;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.09), transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
}

body.is-ready .cursor-glow { opacity: 1; }

@media (hover: none) {
  .cursor-glow { display: none; }
}

/* ==========================================================================
   Header / Navbar
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  width: 100%;
  background-color: transparent;
  transition: var(--theme-transition);
}

.header.is-scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: auto;
  flex-shrink: 0;
}

.nav__logo-text {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, var(--color-text), var(--color-primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.nav__link {
  padding: 0.45rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
}

.nav__link:hover,
.nav__link.active {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex-shrink: 0;
  position: relative;
}

.theme-toggle,
.nav__toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover,
.nav__toggle:hover {
  border-color: var(--color-primary);
}

.theme-toggle {
  position: relative;
  flex-shrink: 0;
}

.theme-toggle svg {
  pointer-events: none;
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  position: absolute;
  transition: opacity var(--transition);
}

html:not(.dark) .theme-toggle__icon--light { opacity: 1; }
html:not(.dark) .theme-toggle__icon--dark { opacity: 0; }
html.dark .theme-toggle__icon--light { opacity: 0; }
html.dark .theme-toggle__icon--dark { opacity: 1; }

.nav__toggle {
  display: none;
}

.nav__toggle svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* Overlay tối phía sau menu (dưới header z-index 1000) */
body.nav-open::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 900;
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

/* Header + menu luôn nổi trên overlay */
body.nav-open .header {
  z-index: 1100;
}

html:not(.dark) body.nav-open::after {
  background: rgba(15, 15, 20, 0.3);
}

/* ==========================================================================
   Reveal animation
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  transform: translateX(-28px);
}

.reveal-left.is-visible {
  transform: translateX(0);
}

.reveal-right {
  transform: translateX(28px);
}

.reveal-right.is-visible {
  transform: translateX(0);
}

.reveal-scale {
  transform: scale(0.88);
}

.reveal-scale.is-visible {
  transform: scale(1);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  padding-top: var(--header-h);
  padding-bottom: var(--gap-xl);
  position: relative;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.85;
}

.hero__glow--1 {
  width: min(380px, 70vw);
  height: min(380px, 70vw);
  top: 5%;
  left: 0;
  background: rgba(var(--color-primary-rgb), 0.2);
}

.hero__glow--2 {
  width: min(300px, 55vw);
  height: min(300px, 55vw);
  bottom: 5%;
  right: 0;
  background: rgba(139, 111, 255, 0.12);
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap-xl);
  align-items: center;
  width: 100%;
}

.hero__text {
  min-width: 0;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  margin-bottom: var(--gap-md);
  font-size: var(--text-sm);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  background: rgba(var(--color-primary-rgb), 0.08);
}

.hero__badge svg {
  width: 1em;
  height: 1em;
}

.hero__name {
  display: block;
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-text) 10%, var(--color-primary) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  overflow-wrap: break-word;
}

.hero__role {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-hero-role);
  color: var(--color-primary);
}

.hero__subtitle {
  margin-top: var(--gap-md);
  margin-bottom: var(--gap-lg);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 32rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
}

.hero__visual {
  position: relative;
  min-width: 0;
  width: 100%;
}

.hero__image-wrap {
  aspect-ratio: 4 / 3;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(var(--color-primary-rgb), 0.2);
}

.hero__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero__float {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  z-index: 2;
}

.hero__float svg {
  width: 14px;
  height: 14px;
  color: var(--color-primary);
}

.hero__float--1 {
  top: 8%;
  left: 4%;
}

.hero__float--2 {
  bottom: 8%;
  right: 4%;
}

.hero__float--1.is-visible {
  animation: floatDrift 5s ease-in-out 0.65s infinite;
}

.hero__float--2.is-visible {
  animation: floatDrift 5.5s ease-in-out 1.2s infinite reverse;
}

@keyframes floatDrift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.hero__visual.is-visible .hero__image-wrap img {
  animation: heroImageIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero__visual:hover .hero__image-wrap img {
  transform: scale(1.04);
}

@keyframes heroImageIn {
  from {
    opacity: 0;
    transform: scale(1.06);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scroll-indicator {
  position: absolute;
  bottom: var(--gap-md);
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 38px;
  border: 2px solid var(--color-border);
  border-radius: 20px;
  z-index: 2;
}

.scroll-indicator__wheel {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 7px;
  margin-left: -2px;
  background: var(--color-primary);
  border-radius: 4px;
  animation: scrollWheel 1.6s ease-in-out infinite;
}

@keyframes scrollWheel {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(10px); }
}

/* ==========================================================================
   About
   ========================================================================== */
.about__layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: var(--gap-xl);
  align-items: center;
}

.about__profile,
.about__content {
  min-width: 0;
}

.about__profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.about__avatar-wrap {
  position: relative;
  width: min(100%, 300px);
  max-width: 300px;
  margin-inline: auto;
  margin-bottom: var(--gap-md);
  flex-shrink: 0;
}

.about__avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  z-index: 0;
  background: conic-gradient(
    from 0deg,
    #22d3ee,
    #3b82f6,
    #8b5cf6,
    #a78bfa,
    #22d3ee
  );
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 68%);
  mask: radial-gradient(circle, transparent 66%, #000 68%);
  opacity: 0.65;
  animation: rotateGlow 4.5s linear infinite;
  will-change: transform;
  pointer-events: none;
}

.about__avatar-wrap.is-visible {
  animation: avatarFloat 5s ease-in-out 0.5s infinite;
}

.about__avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
}

.about__avatar.img-overlay {
  border-radius: 50%;
}

.about__avatar.img-overlay::after {
  border-radius: 50%;
}

@keyframes avatarFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-sm);
  width: 100%;
}

.stat-card {
  padding: var(--gap-sm) var(--gap-xs);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 28px rgba(var(--color-primary-rgb), 0.14);
  border-color: rgba(var(--color-primary-rgb), 0.35);
}

.stat-card strong {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-primary);
}

.stat-card span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

.about__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.about__card {
  padding: var(--gap-md);
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-start;
  min-height: 100%;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.about__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(var(--color-primary-rgb), 0.12);
  border-color: rgba(var(--color-primary-rgb), 0.3);
}

.about__card:hover svg {
  transform: scale(1.12);
  transition: transform 0.35s ease;
}

.about__card svg {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.about__card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.55;
}

.about__fb {
  width: fit-content;
  max-width: 100%;
}

/* ==========================================================================
   Skills
   ========================================================================== */
.skills__grid {
  display: grid;
  gap: var(--gap-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  align-items: stretch;
  margin-bottom: var(--gap-xl);
}

.skill-card {
  padding: var(--gap-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}

.skill-card__head {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.skill-card__head svg {
  width: 26px;
  height: 26px;
  color: var(--color-primary);
}

.skill-card__head h3 {
  font-size: var(--text-h3);
}

.skill-list {
  flex: 1;
}

.skill-list li {
  margin-bottom: var(--gap-sm);
}

.skill-list li span {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.skill-bar {
  height: 5px;
  background: var(--color-surface);
  border-radius: 99px;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.skill-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--color-primary), #8b6fff);
  border-radius: inherit;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-bar.is-animated::after {
  width: calc(var(--level) * 1%);
}

.skills__visual {
  width: 100%;
}

.skills__img {
  aspect-ratio: 16 / 7;
  width: 100%;
}

/* ==========================================================================
   Projects — portfolio showcase
   ========================================================================== */
.projects .section__header {
  max-width: 38rem;
  margin-bottom: var(--gap-xl);
}

.project-featured {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--gap-lg);
  align-items: stretch;
  margin-bottom: var(--gap-xl);
  padding-bottom: var(--gap-xl);
  border-bottom: 1px solid var(--color-border);
}

.project-featured__visual {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.project-featured__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-featured__label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: blur(8px);
}

.project-featured__hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(10, 10, 15, 0.55);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.project-featured__hover svg {
  width: 18px;
  height: 18px;
}

.project-featured__visual:hover img {
  transform: scale(1.05);
}

.project-featured__visual:hover .project-featured__hover {
  opacity: 1;
}

.project-featured__info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--gap-sm);
  padding: var(--gap-md) 0;
}

.project-featured__meta {
  display: flex;
  align-items: baseline;
  gap: var(--gap-md);
  flex-wrap: wrap;
}

.project-featured__index,
.project-row__index {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(var(--color-primary-rgb), 0.35);
}

.project-featured__stack,
.project-row__stack {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.project-featured__title,
.project-row__title {
  font-size: clamp(1.35rem, 2.5vw, var(--text-h2));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.project-featured__desc,
.project-row__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  max-width: 32rem;
}

.project-featured__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--gap-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  width: fit-content;
}

.project-featured__link svg {
  width: 15px;
  height: 15px;
}

.projects__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-xl);
  align-items: center;
  padding: var(--gap-xl) 0;
  border-bottom: 1px solid var(--color-border);
}

.project-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.project-row--reverse .project-row__visual {
  order: 2;
}

.project-row--reverse .project-row__content {
  order: 1;
}

.project-row__visual {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.project-row__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-row:hover .project-row__visual img {
  transform: scale(1.04);
}

.project-row__content {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: var(--gap-sm) 0;
}

.project-row__index {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

@media (max-width: 992px) {
  .project-featured {
    grid-template-columns: 1fr;
    gap: var(--gap-md);
  }

  .project-row,
  .project-row--reverse {
    grid-template-columns: 1fr;
    gap: var(--gap-md);
    padding: var(--gap-lg) 0;
  }

  .project-row--reverse .project-row__visual,
  .project-row--reverse .project-row__content {
    order: unset;
  }
}

@media (max-width: 576px) {
  .projects .section__header {
    margin-bottom: var(--gap-lg);
  }

  .project-featured {
    margin-bottom: var(--gap-lg);
    padding-bottom: var(--gap-lg);
  }

  .project-featured__info {
    padding: 0;
  }
}

/* ==========================================================================
   Services
   ========================================================================== */
.services__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap-xl);
  align-items: center;
  margin-bottom: var(--gap-xl);
}

.services__visual,
.services__list {
  min-width: 0;
}

.services__img {
  aspect-ratio: 4 / 3;
  width: 100%;
}

.services__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.services__list li {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.services__list li:last-child {
  border-bottom: none;
}

.services__list svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.pricing__grid {
  display: grid;
  gap: var(--gap-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  align-items: stretch;
  margin-bottom: var(--gap-md);
}

.pricing-card {
  padding: var(--gap-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  height: 100%;
}

.pricing-card h3 {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--gap-sm);
}

.pricing-card__price {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
}

.pricing-card__note {
  margin-top: var(--gap-xs);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.pricing-card--highlight {
  border-color: rgba(var(--color-primary-rgb), 0.5);
  box-shadow: var(--shadow-hover);
}

.services__joke {
  text-align: center;
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact__layout {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.contact__banner {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 7;
  min-height: 160px;
}

.contact__banner-text {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--gap-lg);
  z-index: 2;
}

.contact__banner-text h3 {
  font-size: var(--text-lg);
  margin-bottom: 0.25rem;
}

.contact__banner-text p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.contact__grid {
  display: grid;
  gap: var(--gap-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: stretch;
}

.contact-card {
  padding: var(--gap-lg) var(--gap-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  height: 100%;
}

.contact-card svg {
  width: 28px;
  height: 28px;
  color: var(--color-primary);
  margin-bottom: var(--gap-sm);
}

.contact-card h3 {
  font-size: var(--text-base);
  margin-bottom: 0.25rem;
}

.contact-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  word-break: break-word;
}

.contact__cta {
  text-align: center;
  margin-top: var(--gap-md);
}

/* ==========================================================================
   Footer & FAB
   ========================================================================== */
.footer {
  width: 100%;
  padding: var(--gap-lg) 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.messenger-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 900;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-primary), #6c4dff);
  color: #0a0a0f;
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(var(--color-primary-rgb), 0.45);
  transition: transform var(--transition);
}

.messenger-fab svg {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 2;
}

.messenger-fab:hover {
  transform: scale(1.06);
}

.messenger-fab__pulse {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--color-primary);
  animation: fabPulse 2s ease-out infinite;
}

.messenger-fab__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.35), transparent 70%);
}

@keyframes fabPulse {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ==========================================================================
   Responsive breakpoints
   ========================================================================== */

/* <= 1440px: large desktop */
@media (max-width: 1440px) {
  :root {
    --container-max: 1140px;
  }
}

/* <= 1200px: laptop */
@media (max-width: 1200px) {
  :root {
    --container-max: 960px;
    --gap-xl: 2.5rem;
  }

  .hero__grid {
    gap: var(--gap-lg);
  }
}

/* <= 992px: tablet - mobile nav */
@media (max-width: 992px) {
  :root {
    --section-py: 80px;
    --header-h: 68px;
    --grid-card-min: 260px;
  }

  .nav__menu {
    position: fixed;
    top: var(--header-h);
    right: 0;
    width: min(300px, 100%);
    max-width: 100vw;
    height: calc(100dvh - var(--header-h));
    flex-direction: column;
    align-items: stretch;
    padding: var(--gap-md);
    background: var(--header-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-left: 1px solid var(--color-border);
    transform: translateX(100%);
    transition: transform var(--transition);
    z-index: 2;
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
  }

  .nav__menu.is-open {
    transform: translateX(0);
  }

  .nav__toggle {
    display: grid;
  }

  .nav__link {
    padding: 0.85rem 1rem;
  }

  .section__glow {
    display: none;
  }

  .about__layout,
  .services__layout {
    grid-template-columns: 1fr;
    gap: var(--gap-lg);
  }

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

  .about__fb {
    margin-inline: auto;
  }
}

/* <= 768px: mobile landscape / large phone */
@media (max-width: 768px) {
  :root {
    --section-py: 64px;
  }

  .container {
    width: min(var(--container-max), calc(100% - 24px));
  }

  .section__header {
    margin-bottom: var(--gap-lg);
  }

  /* Hero 1 cột: text trước, ảnh sau */
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--gap-lg);
  }

  .hero__text {
    order: 1;
    text-align: center;
  }

  .hero__visual {
    order: 2;
    max-width: 100%;
  }

  .hero {
    padding-bottom: 3.5rem;
  }

  .hero__subtitle {
    margin-inline: auto;
    max-width: 100%;
  }

  .hero__badge {
    margin-inline: auto;
  }

  .hero__cta {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
  }

  .hero__cta .btn {
    width: 100%;
  }

  .hero__float {
    display: none;
  }

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

  .about__avatar-wrap {
    width: min(100%, 260px);
    max-width: 260px;
  }

  .nav__logo-text {
    display: none;
  }

  .contact__banner {
    aspect-ratio: 16 / 9;
  }

  .contact__banner-text {
    padding: var(--gap-md);
  }
}

/* <= 576px: mobile */
@media (max-width: 576px) {
  .container {
    width: min(var(--container-max), calc(100% - 20px));
  }

  .hero__grid {
    gap: var(--gap-md);
  }

  .pricing-card__price {
    font-size: var(--text-base);
  }
}

/* <= 420px: small mobile */
@media (max-width: 420px) {
  :root {
    --gap-md: 1.15rem;
    --gap-lg: 1.5rem;
  }

  .btn {
    padding: 0.7rem 1rem;
  }

  .messenger-fab {
    width: 50px;
    height: 50px;
    bottom: 1rem;
    right: 1rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

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