/* ============================================================
   MA ĐỨC ANH — "FROM SAPA TO CODE"
   Portfolio Design System v2 — Sapa Mist
   
   Personality: Quiet, deliberate, warm, responsible
   Visual: Mountain silhouettes, mist, teal+gold, organic
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600;700&family=Ephesis&display=swap');

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* --- Sapa Night (Dark Default) --- */
  --bg-deep:       #0B0F14;
  --bg-primary:    #0D1117;
  --bg-surface:    #151B23;
  --bg-elevated:   #1C2333;
  --border:        #2D3748;
  --border-subtle: #1E2A3A;

  --text-primary:  #E8E6E1;
  --text-secondary:#8B9AAF;
  --text-muted:    #4A5568;

  /* Sapa Palette */
  --accent:        #4FD1C5;  /* terraced teal */
  --accent-glow:   rgba(79,209,197,0.12);
  --accent-hover:  #81E6D9;
  --accent-soft:   rgba(79,209,197,0.08);
  --gold:          #D69E2E;  /* sunlight through clouds */
  --gold-glow:     rgba(214,158,46,0.12);
  --gold-soft:     rgba(214,158,46,0.08);
  --green:         #68D391;  /* spring leaves */
  --mist:          rgba(139,154,175,0.06);

  /* Mountain layers */
  --mountain-far:    #0E1218;
  --mountain-mid:    #111820;
  --mountain-near:   #151D28;
  --mountain-accent: #1A2332;

  --overlay:       rgba(11,15,20,0.92);

  /* --- Typography --- */
  --font-heading: 'Outfit', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --text-xs:   clamp(0.7rem, 1.5vw, 0.8rem);
  --text-sm:   clamp(0.8rem, 1.8vw, 0.9rem);
  --text-base: clamp(0.95rem, 2vw, 1.05rem);
  --text-lg:   clamp(1.05rem, 2.3vw, 1.15rem);
  --text-xl:   clamp(1.15rem, 2.8vw, 1.35rem);
  --text-2xl:  clamp(1.4rem, 3.5vw, 1.85rem);
  --text-3xl:  clamp(1.7rem, 4.5vw, 2.5rem);
  --text-hero: clamp(2.2rem, 6.5vw, 4rem);

  /* --- Spacing --- */
  --section-padding: clamp(4rem, 10vh, 7rem);
  --container-width: 1100px;
  --gap-xs:  0.5rem;
  --gap-sm:  1rem;
  --gap-md:  1.5rem;
  --gap-lg:  2rem;
  --gap-xl:  3rem;
  --gap-2xl: 4rem;

  /* --- Radius --- */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* --- Motion: SLOW & DELIBERATE (matches quiet personality) --- */
  --ease-gentle:  cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);

  --dur-fast:  250ms;
  --dur-base:  450ms;
  --dur-slow:  800ms;
  --dur-drift: 1200ms;
}

/* --- Sapa Morning (Light Theme) --- */
[data-theme="light"] {
  --bg-deep:       #F5F3EE;
  --bg-primary:    #FAFAF7;
  --bg-surface:    #F0EDE6;
  --bg-elevated:   #E8E4DC;
  --border:        #D4CFC5;
  --border-subtle: #E8E4DC;
  --text-primary:  #1A1D23;
  --text-secondary:#5A6171;
  --text-muted:    #8B9AAF;
  --accent:        #2C9E94;
  --accent-glow:   rgba(44,158,148,0.1);
  --accent-hover:  #237F77;
  --accent-soft:   rgba(44,158,148,0.06);
  --gold:          #B8860B;
  --gold-glow:     rgba(184,134,11,0.1);
  --gold-soft:     rgba(184,134,11,0.06);
  --mountain-far:    #EDE9E0;
  --mountain-mid:    #E5E1D8;
  --mountain-near:   #DDD9D0;
  --mountain-accent: #D5D0C7;
  --overlay:       rgba(250,250,247,0.92);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Slow, deliberate theme transition */
  transition: background-color var(--dur-slow) var(--ease-gentle),
              color var(--dur-slow) var(--ease-gentle);
}

body.no-scroll { overflow: hidden; }

/* Subtle mist texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-base) var(--ease-gentle);
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
}

/* ============================================================
   3. NAVIGATION — quiet, minimal
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 0.85rem 0;
  background: transparent;
  transition: all var(--dur-base) var(--ease-gentle);
  border-bottom: 1px solid transparent;
}

.navbar.scrolled {
  background: rgba(13,17,23,0.88);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .navbar.scrolled {
  background: rgba(250,250,247,0.88);
}

.nav-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Ephesis', cursive;
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: normal;
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  margin-bottom: -1.2rem;
  transform: rotate(-3deg);
  transform-origin: left center;
  transition: all var(--dur-base) var(--ease-gentle);
  z-index: 10;
  line-height: 1;
}
.nav-logo:hover {
  transform: rotate(-1deg) scale(1.04);
}

.nav-logo-icon {
  font-size: 1.15rem;
  margin-right: 0.5rem;
  display: inline-block;
  transform: rotate(3deg);
  transition: transform 0.4s var(--ease-gentle);
  margin-top: -0.2rem;
}
.nav-logo:hover .nav-logo-icon {
  transform: translateY(-2px) rotate(1deg) scale(1.1);
}

.nav-logo-dot {
  color: var(--accent);
  font-weight: 900;
  margin: 0 0.03em;
  display: inline-block;
}

.nav-logo .accent { color: var(--accent); }
.nav-logo .gold {
  background: linear-gradient(120deg, var(--gold) 0%, #FFE4A0 40%, var(--gold) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.4s ease;
}
.nav-logo:hover .gold {
  animation: shimmer 1.5s ease-in-out forwards;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
}

.nav-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--dur-base) var(--ease-gentle);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-secondary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle,
.lang-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-base) var(--ease-gentle);
}

.theme-toggle:hover,
.lang-toggle:hover {
  border-color: var(--border);
  color: var(--text-secondary);
}

.lang-toggle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Hamburger */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  gap: 5px;
  padding: 8px;
}

.mobile-menu-btn span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  transition: all var(--dur-base) var(--ease-gentle);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

/* Mobile overlay */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--overlay);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-gentle);
}

.mobile-menu.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu .nav-link {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================================
   4. HERO — Mountains & Mist
   ============================================================ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

/* Fog canvas */
#fog-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
}

/* Mountain SVG layers */
.mountains {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  pointer-events: none;
}

.mountain-layer {
  position: absolute;
  bottom: 0;
  left: -5%;
  width: 110%;
}

.mountain-far  { z-index: 1; }
.mountain-mid  { z-index: 2; }
.mountain-near { z-index: 3; }

.mountain-far  svg { fill: var(--mountain-far); }
.mountain-mid  svg { fill: var(--mountain-mid); }
.mountain-near svg { fill: var(--mountain-near); }

/* Subtle golden glow on horizon */
.horizon-glow {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(400px, 60vw, 800px);
  height: clamp(100px, 15vh, 200px);
  background: radial-gradient(ellipse, var(--gold-soft) 0%, transparent 70%);
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

.hero-content {
  text-align: center;
  position: relative;
  z-index: 10;
  padding: 2rem 1rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.35rem 1rem;
  margin-bottom: var(--gap-lg);
  background: var(--mist);
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 3s ease-in-out infinite;
}

.hero-greeting {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: var(--gap-sm);
}

.hero-name .accent { color: var(--accent); }
.hero-name .gold {
  background: linear-gradient(120deg, var(--gold) 0%, #FFE4A0 25%, var(--gold) 50%, #FFE4A0 75%, var(--gold) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s ease-in-out infinite;
}

.hero-tagline {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: var(--gap-xs);
}

.hero-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto var(--gap-lg);
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
  animation: float 4s ease-in-out infinite;
}

.scroll-indicator svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
}

/* ============================================================
   5. BUTTONS — understated but intentional
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-gentle);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--bg-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* Contact CTA attention pulse */
#contact .btn-primary {
  animation: ctaPulse 3s ease-in-out infinite;
}
#contact .btn-primary:hover {
  animation: none;
  box-shadow: 0 4px 24px var(--accent-glow), 0 0 0 2px var(--accent-glow);
}

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

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  transform: translateY(-1px);
}

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

.btn-gold:hover {
  background: var(--gold-soft);
  transform: translateY(-1px);
}

/* ============================================================
   6. SECTION SHARED
   ============================================================ */
.section {
  padding: var(--section-padding) 0;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--gap-xs);
}

.section-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--border);
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--gap-md);
}

.section-title .accent { color: var(--accent); }
.section-title .gold { color: var(--gold); }

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.7;
}

.section-alt {
  background: var(--bg-deep);
}

/* Centered section header */
.section-header-center {
  text-align: center;
  margin-bottom: var(--gap-xl);
}

.section-header-center .section-label::before { display: none; }

.section-header-center .section-subtitle {
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   7. ABOUT — The story
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: var(--gap-2xl);
  align-items: center;
  margin-top: var(--gap-lg);
}

.about-image-wrapper {
  position: relative;
}

/* Terraced frame effect */
.about-image-wrapper::before {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  bottom: 8px;
  left: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--dur-slow) var(--ease-gentle);
}

.about-image-wrapper:hover::before {
  border-color: var(--accent);
  top: -12px;
  right: -12px;
}

.about-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
  filter: grayscale(10%) contrast(1.02);
  transition: filter var(--dur-slow) var(--ease-gentle);
}

.about-image-wrapper:hover .about-image {
  filter: grayscale(0%) contrast(1.05);
}

.about-description {
  color: var(--text-secondary);
  line-height: 1.85;
  margin-top: var(--gap-sm);
}

.about-description p + p {
  margin-top: var(--gap-sm);
}

/* Quote-style callout */
.about-quote {
  margin-top: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md);
  border-left: 2px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  margin-top: var(--gap-xl);
  padding-top: var(--gap-lg);
  border-top: 1px solid var(--border-subtle);
}

.stat-item { text-align: center; }

.stat-number {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

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

/* About: embedded skill tags */
.about-skills {
  margin-top: var(--gap-md);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.about-skill-group {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.about-skill-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--accent);
  min-width: 42px;
  padding: 0.2rem 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  margin-top: 0.35rem;
}

.about-skills .skill-tags { gap: 0.3rem; }

.about-skills .skill-tag {
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
}

/* Education trail stop */
.trail-stop-edu .trail-content {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--gold-soft) 100%);
}

.trail-marker-edu {
  border-color: var(--text-muted) !important;
}

.trail-stop-edu:hover .trail-marker-edu {
  background: var(--text-muted) !important;
  box-shadow: none !important;
}

.edu-header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.edu-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-primary);
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.trail-header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.trail-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-primary);
  padding: 3px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.trail-edu-quote {
  margin-top: var(--gap-xs);
  padding: 0.5rem 0.8rem;
  border-left: 2px solid var(--gold);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.edu-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-top: var(--gap-xs);
  letter-spacing: 0.02em;
}

.trail-stop-edu .trail-date {
  color: var(--text-muted);
}

/* ============================================================
   8. PROJECTS — Gallery cards
   ============================================================ */
.projects-grid {
  display: grid;
  gap: var(--gap-md);
  margin-top: var(--gap-lg);
}

.project-card.featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--dur-slow) var(--ease-gentle);
}

.project-card.featured:hover {
  border-color: var(--border);
}

.project-card.featured .project-image-wrapper {
  aspect-ratio: auto;
  height: 100%;
}

.project-card.featured .project-image { height: 100%; }

.project-card.featured .project-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Regular project cards */
.projects-grid-inner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-md);
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--dur-slow) var(--ease-gentle);
}

.project-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2), 0 0 0 1px var(--accent-glow);
}

.project-image-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--bg-elevated);
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-gentle);
}

.project-card:hover .project-image {
  transform: scale(1.03);
}

/* Mist overlay on hover */
.project-image-wrapper .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-deep) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-gentle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card:hover .overlay { opacity: 0.6; }

.project-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  color: var(--text-muted);
  font-size: 2rem;
  gap: 0.5rem;
}

.project-placeholder span {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.project-info {
  padding: var(--gap-md);
}

.project-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--gap-sm);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.tag.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.tag.gold {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: transparent;
}

/* ============================================================
   9. EXPERIENCE — Winding mountain trail
   ============================================================ */
.trail-wrapper {
  position: relative;
  margin-top: var(--gap-xl);
}

/* SVG trail path (behind everything) */
.trail-svg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.trail-path {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-dasharray: 8 6;
  stroke-linecap: round;
  animation: trailWalk 2s linear infinite;
}

/* Container for alternating items */
.trail-items {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
}

.trail-stop {
  display: flex;
  align-items: flex-start;
  width: 100%;
  position: relative;
}

/* Alternate left / right */
.trail-stop:nth-child(odd) {
  justify-content: flex-start;
  padding-right: calc(50% + 30px);
}

.trail-stop:nth-child(even) {
  justify-content: flex-end;
  padding-left: calc(50% + 30px);
}

/* Trail marker dot (centered on the path) */
.trail-marker {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  background: var(--bg-primary);
  z-index: 3;
  transition: all var(--dur-slow) var(--ease-gentle);
}

/* Marker glow ring */
.trail-marker::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-gentle);
}

.trail-stop:hover .trail-marker {
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.trail-stop:hover .trail-marker::after {
  opacity: 0.3;
}

/* First stop = gold (current position on mountain) */
.trail-stop:first-child .trail-marker {
  border-color: var(--gold);
  width: 22px;
  height: 22px;
  top: 5px;
}

.trail-stop:first-child .trail-marker::after {
  border-color: var(--gold);
  animation: trailPulse 3s ease-in-out infinite;
}

.trail-stop:first-child:hover .trail-marker {
  background: var(--gold);
  box-shadow: 0 0 18px var(--gold-glow);
}

/* Small "you are here" label */
.trail-marker-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -22px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--gold);
  white-space: nowrap;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

/* Trail content card */
.trail-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
  width: 100%;
  transition: all var(--dur-slow) var(--ease-gentle);
  position: relative;
}

.trail-content:hover {
  border-color: var(--border);
}

/* Small arrow pointing to center trail */
.trail-stop:nth-child(odd) .trail-content::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 14px;
  width: 16px;
  height: 16px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  transform: rotate(-45deg);
  transition: border-color var(--dur-slow) var(--ease-gentle);
}

.trail-stop:nth-child(even) .trail-content::after {
  content: '';
  position: absolute;
  left: -8px;
  top: 14px;
  width: 16px;
  height: 16px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  border-top: 1px solid var(--border-subtle);
  transform: rotate(-45deg);
  transition: border-color var(--dur-slow) var(--ease-gentle);
}

.trail-stop:hover .trail-content::after {
  border-color: var(--border);
}

.trail-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.trail-stop:first-child .trail-date {
  color: var(--gold);
}

.trail-role {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.trail-company {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--gap-xs);
}

.trail-details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.trail-details li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 1rem;
  position: relative;
}

.trail-details li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2em;
}

.trail-stop:first-child .trail-details li::before {
  color: var(--gold);
}

@keyframes trailPulse {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

/* ============================================================
   10. SKILLS — Glowing tags (fireflies in the forest)
   ============================================================ */
.skills-categories {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  margin-top: var(--gap-lg);
}

.skill-category-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  padding-left: var(--gap-sm);
  border-left: 2px solid var(--accent);
  margin-bottom: var(--gap-xs);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-tag {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: default;
  transition: all var(--dur-slow) var(--ease-gentle);
}

/* Firefly glow on hover */
.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 0 4px var(--accent-glow);
  transform: translateY(-1px);
}

/* Staggered firefly pulse for every 3rd tag */
.skill-tag:nth-child(3n+1):hover {
  animation: fireflyPulse 1.8s ease-in-out infinite 0.2s;
}
.skill-tag:nth-child(3n+2):hover {
  animation: fireflyPulse 2.2s ease-in-out infinite 0.5s;
}

/* ============================================================
   11. SERVICES — Clean cards
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-sm);
  margin-top: var(--gap-lg);
}

.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
  transition: all var(--dur-slow) var(--ease-gentle);
}

.service-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.service-icon {
  font-size: 1.5rem;
  margin-bottom: var(--gap-xs);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.service-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.service-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   CASE STUDY — Deep dive
   ============================================================ */
.case-study-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-top: var(--gap-lg);
}

.case-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.case-icon {
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.case-name {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.case-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.case-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.case-block {
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.case-problem {
  border-left: 3px solid #ef4444;
  background: rgba(239,68,68,0.03);
}

.case-solution {
  border-left: 3px solid #22c55e;
  background: rgba(34,197,94,0.03);
}

.case-block-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.case-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.case-list li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-left: 1rem;
  position: relative;
  line-height: 1.5;
}

.case-list li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.case-results {
  padding: 1.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.case-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 0.75rem;
}

.case-metric { text-align: center; }

.case-metric-value {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
}

.case-metric-value.accent { color: var(--accent); }
.case-metric-value.gold { color: var(--gold); }

.case-metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.case-quote {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--gold);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--gold-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ============================================================
   PROCESS — How I work
   ============================================================ */
.process-steps {
  max-width: 700px;
  margin: var(--gap-lg) auto 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.process-step {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--dur-base) var(--ease-gentle);
}

.process-step:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.process-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
  flex-shrink: 0;
  min-width: 48px;
  transition: opacity var(--dur-base);
}

.process-step:hover .process-number { opacity: 1; }

.process-step-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.process-step-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.process-connector {
  width: 2px;
  height: 24px;
  background: var(--border);
  margin: 0 auto;
  border-radius: 1px;
}

/* ============================================================
   PERSONAL — The human behind code
   ============================================================ */
.personal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-lg);
  margin-top: var(--gap-lg);
  align-items: start;
}

.personal-story p {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.personal-story p:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.personal-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.5rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  aspect-ratio: 4/3;
}

.gallery-item.gallery-main {
  grid-column: 1 / -1;
  aspect-ratio: 16/9;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-gentle);
}

.gallery-item:hover img { transform: scale(1.05); }

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
}

.gallery-placeholder {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 2rem;
  gap: 0.5rem;
}

.gallery-placeholder span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  opacity: 0.5;
}

.personal-values {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: var(--gap-lg);
}

.value-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  transition: all var(--dur-base) var(--ease-gentle);
}

.value-item:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  transform: translateY(-2px);
}

.value-emoji { font-size: 1.1rem; }
.value-text { color: var(--text-secondary); }

/* ============================================================
   TESTIMONIALS — Marquee Slideshow
   ============================================================ */
.testimonial-marquee {
  overflow: hidden;
  width: 100%;
  margin-top: var(--gap-lg);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.testimonial-track {
  display: flex;
  gap: 1.25rem;
  animation: marquee-scroll 40s linear infinite;
  width: max-content;
}

.testimonial-track:hover {
  animation-play-state: paused;
}

@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.testimonial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  min-width: 320px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

.testimonial-card:hover {
  border-top-color: var(--gold);
}

.testimonial-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.testimonial-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.testimonial-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.testimonial-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.tag.gold {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold);
}

/* ============================================================
   12. CONTACT
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--gap-2xl);
  align-items: start;
  margin-top: var(--gap-lg);
}

.contact-subtitle {
  color: var(--text-secondary);
  margin-top: var(--gap-xs);
  line-height: 1.7;
  font-size: var(--text-sm);
}

.contact-items {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.contact-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.contact-item-text { display: flex; flex-direction: column; }

.contact-item-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.contact-item-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.contact-item-value a { color: var(--text-primary); }
.contact-item-value a:hover { color: var(--accent); }

.social-links {
  display: flex;
  gap: 0.5rem;
  margin-top: var(--gap-md);
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--dur-base) var(--ease-gentle);
}

.social-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--gap-md);
}

.form-group { display: flex; flex-direction: column; }

.form-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.04em;
}

.form-input,
.form-textarea {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: all var(--dur-base) var(--ease-gentle);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-submit { margin-top: var(--gap-xs); }

/* ============================================================
   13. FOOTER — with AI badge
   ============================================================ */
.footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border-subtle);
  padding: var(--gap-lg) 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap-sm);
}

.footer-text {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.7rem;
  opacity: 0.7;
  transition: opacity var(--dur-base) var(--ease-gentle);
}

.footer-ai-badge:hover {
  opacity: 1;
  border-color: var(--border);
}

.footer-ai-badge .ai-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 3s ease-in-out infinite;
}

/* ============================================================
   14. BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all var(--dur-base) var(--ease-gentle);
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   15. LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-gentle);
  cursor: zoom-out;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transform: scale(0.95);
  transition: transform var(--dur-slow) var(--ease-gentle);
}

.lightbox.active .lightbox-img { transform: scale(1); }

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast);
}

.lightbox-close:hover { background: rgba(255,255,255,0.15); }

/* ============================================================
   16. KEYFRAMES — slow, gentle, deliberate
   ============================================================ */
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
  50% { transform: translateX(-50%) translateY(-8px); opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes trailWalk {
  to { stroke-dashoffset: -28; }
}

@keyframes fireflyPulse {
  0%, 100% { box-shadow: 0 0 12px var(--accent-glow), 0 0 4px var(--accent-glow); }
  50% { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow), 0 0 6px var(--accent-glow); }
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,209,197,0.4); }
  50% { box-shadow: 0 0 20px 4px rgba(79,209,197,0.15); }
}

@keyframes mistDrift {
  0% { transform: translateX(0); opacity: 0; }
  15% { opacity: 0.5; }
  85% { opacity: 0.5; }
  100% { transform: translateX(100px); opacity: 0; }
}

/* ============================================================
   17. SCROLL REVEAL — gentle fade, not aggressive
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-gentle),
              transform var(--dur-slow) var(--ease-gentle);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity var(--dur-slow) var(--ease-gentle),
              transform var(--dur-slow) var(--ease-gentle);
}

.reveal-right {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--dur-slow) var(--ease-gentle),
              transform var(--dur-slow) var(--ease-gentle);
}

.reveal.revealed,
.reveal-left.revealed,
.reveal-right.revealed {
  opacity: 1;
  transform: translate(0, 0);
}

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }
.reveal-delay-5 { transition-delay: 500ms; }
.reveal-delay-6 { transition-delay: 600ms; }

/* ============================================================
   18. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-left, .reveal-right {
    opacity: 1; transform: none;
  }
  #fog-canvas { display: none; }
}

/* ============================================================
   19. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card.featured { grid-template-columns: 1fr; }
  .project-card.featured .project-image-wrapper { aspect-ratio: 16/9; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--gap-lg);
  }
  .about-image-wrapper {
    max-width: 280px;
    margin: 0 auto;
  }
  .about-stats { grid-template-columns: repeat(2, 1fr); }

  .services-grid { grid-template-columns: 1fr; }
  .projects-grid-inner { grid-template-columns: 1fr; }

  /* Trail: collapse to single column */
  .trail-svg { display: none; }
  .trail-stop,
  .trail-stop:nth-child(odd),
  .trail-stop:nth-child(even) {
    padding-left: 48px;
    padding-right: 0;
    justify-content: flex-start;
  }
  .trail-marker,
  .trail-stop:first-child .trail-marker {
    left: 0;
    transform: translateX(0);
    width: 14px;
    height: 14px;
    top: 8px;
  }
  .trail-marker-label {
    left: 0;
    transform: none;
    top: -18px;
    font-size: 0.55rem;
  }
  .trail-stop:nth-child(odd) .trail-content::after,
  .trail-stop:nth-child(even) .trail-content::after {
    display: none;
  }
  .trail-items::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border) 5%, var(--border) 95%, transparent);
  }

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

  /* Case study mobile */
  .case-grid { grid-template-columns: 1fr; }
  .case-metrics { grid-template-columns: repeat(2, 1fr); }
  .case-study-card { padding: 1.25rem; }

  /* Personal mobile */
  .personal-grid { grid-template-columns: 1fr; }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-cta {
    flex-direction: column;
    width: 100%;
  }
  .hero-cta .btn { width: 100%; }
  .about-stats { gap: var(--gap-xs); }
  .back-to-top { bottom: 1rem; right: 1rem; }
}

/* ============================================================
   ADDITIONAL PORTFOLIO POLISH & MODALS
   ============================================================ */

/* 1. Mountain Trail Winding Path scroll tracking */
.trail-path-draw {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: stroke-dashoffset 0.1s ease-out;
}

/* 2. Pulsating status dot in Navbar */
.nav-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
  background: rgba(74, 222, 128, 0.05);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-right: 0.5rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(74, 222, 128, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

@media (max-width: 900px) {
  .nav-status {
    display: none;
  }
}

/* 3. Interactive project card overlays & tilts */
.project-card {
  cursor: pointer;
  transition: transform 0.15s ease-out, border-color var(--dur-slow) var(--ease-gentle), box-shadow var(--dur-slow) var(--ease-gentle);
}

.project-image-wrapper .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-deep) 0%, rgba(10, 10, 18, 0.9) 100%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-gentle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
}

.project-image-wrapper .overlay::before {
  content: '📄';
  font-size: 1.5rem;
  animation: bounceMini 2s infinite;
}

.project-image-wrapper .overlay::after {
  content: 'Xem Case Study';
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.5px;
}

html[data-lang="en"] .project-image-wrapper .overlay::after {
  content: 'View Case Study';
}

.project-card:hover .overlay {
  opacity: 1;
}

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

/* 4. Sleek Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-notification {
  background: rgba(22, 22, 37, 0.95);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 12px var(--accent-glow);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 5. Interactive Case Study Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 18, 0.75);
  backdrop-filter: blur(12px);
  z-index: 1005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-gentle);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1100px;
  max-height: 95vh;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--dur-base) var(--ease-gentle);
  overflow: hidden;
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  z-index: 10;
  transition: all var(--dur-fast) var(--ease-gentle);
}

.modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}

.modal-content {
  overflow-y: auto;
  padding: 2.5rem;
  height: 100%;
}

.modal-case-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 900px) {
  .modal-case-body.has-image {
    grid-template-columns: 400px 1fr;
    gap: 2.5rem;
  }
}

.modal-case-image-wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  max-height: 520px;
  width: 100%;
}

.modal-case-image-wrapper img {
  width: 100%;
  height: auto;
  max-height: 520px;
  display: block;
  object-fit: contain;
  cursor: zoom-in;
}

/* Modal text styling overrides to ensure layout matches beautifully */
.modal-content .case-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

.modal-content .case-grid {
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .modal-content .case-grid {
    grid-template-columns: 1fr;
  }
  .modal-content .case-metrics {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

body.modal-open {
  overflow: hidden;
}

/* Dynamic gallery inside modal */
.modal-case-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.modal-case-thumbnails {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
}

.modal-thumb {
  height: 90px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.65;
  transition: all var(--dur-fast) var(--ease-gentle);
  background: #0f0f1a;
  object-fit: contain;
  box-sizing: border-box;
}

.modal-thumb.active, .modal-thumb:hover {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.modal-content .case-metric-value {
  font-size: clamp(1.1rem, 2vw, 1.6rem) !important;
  white-space: nowrap;
}

/* Custom S.O.P Case Study Styles */
.case-sop-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2.5rem 0 2rem;
  width: 100%;
}

.case-sop-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.sop-main-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.sop-main-subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--gold);
  text-align: center;
  margin-bottom: 1.5rem;
}

.sop-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sop-section-heading {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  margin-bottom: 0.5rem;
}

.sop-philosophy-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.sop-philosophy-card .quote-mark {
  position: absolute;
  top: -10px;
  right: 15px;
  font-size: 5rem;
  font-family: Georgia, serif;
  color: var(--border-subtle);
  line-height: 1;
  opacity: 0.15;
  pointer-events: none;
}

.sop-philosophy-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  position: relative;
  z-index: 1;
  margin: 0;
}

.sop-anatomy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .sop-anatomy-grid {
    grid-template-columns: 1fr;
  }
}

.sop-anatomy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: all var(--dur-base) var(--ease-gentle);
}

.sop-anatomy-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 15px var(--gold-glow);
  transform: translateY(-2px);
}

.sop-anatomy-card h6 {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.sop-anatomy-card p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.sop-framework-stepper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sop-step {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  align-items: flex-start;
}

.sop-step-number {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.8;
  line-height: 1;
  flex-shrink: 0;
}

.sop-step-content h6 {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
}

.sop-step-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sop-step-content li {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 1.2rem;
  position: relative;
}

.sop-step-content li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
}

.sop-connector {
  width: 2px;
  height: 20px;
  background: var(--border-subtle);
  margin-left: 2.25rem;
}
