/* ============================================================
   thoquan.com — design system v2
   Dark, cinematic, scroll-driven. Apple-style section motion.
   ============================================================ */

:root {
  --bg: #070b14;
  --bg-elevated: #0b1120;
  --surface: rgba(148, 163, 184, 0.06);
  --surface-strong: rgba(148, 163, 184, 0.1);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.25);
  --text: #e8edf7;
  --text-muted: #9aa7bd;
  --text-faint: #64748b;
  --accent-1: #22d3ee;
  --accent-2: #818cf8;
  --accent-3: #c084fc;
  --gradient: linear-gradient(100deg, var(--accent-1), var(--accent-2) 55%, var(--accent-3));
  --font-hero: "Google Sans", "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 18px;
  --max-w: 1140px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

::selection { background: rgba(129, 140, 248, 0.4); }

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; }

/* ---------- ambient animated gradient background ---------- */
.bg-scene {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: var(--bg);
}
.bg-scene::before, .bg-scene::after {
  content: ""; position: absolute;
  width: 130%; height: 130%; left: -15%; top: -15%;
  will-change: transform;
}
.bg-scene::before {
  background:
    radial-gradient(closest-side at 28% 32%, rgba(34, 211, 238, 0.17), transparent),
    radial-gradient(closest-side at 72% 58%, rgba(129, 140, 248, 0.19), transparent);
  filter: blur(64px);
  animation: bgDrift 46s linear infinite;
}
.bg-scene::after {
  background:
    radial-gradient(closest-side at 66% 28%, rgba(192, 132, 252, 0.16), transparent),
    radial-gradient(closest-side at 30% 74%, rgba(34, 211, 238, 0.13), transparent);
  filter: blur(74px);
  animation: bgDrift2 64s linear infinite;
}
@keyframes bgDrift {
  0%   { transform: rotate(0deg) translate3d(0, 0, 0) scale(1); }
  50%  { transform: rotate(180deg) translate3d(4%, 3%, 0) scale(1.15); }
  100% { transform: rotate(360deg) translate3d(0, 0, 0) scale(1); }
}
@keyframes bgDrift2 {
  0%   { transform: rotate(360deg) translate3d(0, 0, 0) scale(1.1); }
  50%  { transform: rotate(180deg) translate3d(-4%, -2%, 0) scale(1.28); }
  100% { transform: rotate(0deg) translate3d(0, 0, 0) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-scene::before, .bg-scene::after { animation: none; }
}

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2.5px; width: 0%;
  background: var(--gradient); z-index: 60;
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 28px;
  height: 68px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-hero); font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em; color: var(--text);
}
.nav-logo .tld { color: var(--text-faint); }
.nav-logo .dot { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: color 0.2s ease; letter-spacing: 0.01em;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta {
  font-size: 13.5px; font-weight: 600; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.nav-cta:hover { border-color: var(--accent-2); background: rgba(129, 140, 248, 0.1); }
.nav-burger { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 6px; }

/* ---------- hero ---------- */
.hero { padding: 172px 0 110px; position: relative; overflow: hidden; }
.hero-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.orb-1 { width: 480px; height: 480px; right: -120px; top: -80px; background: radial-gradient(circle, rgba(129,140,248,0.22), transparent 65%); }
.orb-2 { width: 380px; height: 380px; left: -110px; top: 240px; background: radial-gradient(circle, rgba(34,211,238,0.16), transparent 65%); }
.orb-3 { width: 300px; height: 300px; right: 18%; bottom: -120px; background: radial-gradient(circle, rgba(192,132,252,0.14), transparent 65%); }
.hero-inner { position: relative; will-change: transform, opacity; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-1);
  padding: 7px 15px; border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px; background: rgba(34, 211, 238, 0.06);
  margin-bottom: 30px;
}
.hero-kicker .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-1);
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6); animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(34, 211, 238, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}
.hero h1 {
  font-family: var(--font-hero);
  font-size: clamp(42px, 6.6vw, 76px);
  line-height: 1.04; font-weight: 700; letter-spacing: -0.025em;
  max-width: 900px;
}
.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  margin-top: 28px; max-width: 660px;
  font-size: 19px; color: var(--text-muted); line-height: 1.7;
}
.hero-sub strong { color: var(--text); font-weight: 600; }
.hero-themes { margin-top: 26px; display: flex; gap: 9px; flex-wrap: wrap; }
.hero-actions { margin-top: 40px; display: flex; gap: 16px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 28px; border-radius: 12px; font-weight: 600; font-size: 15px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--gradient); color: #06090f;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(99, 102, 241, 0.45); }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-2); background: rgba(129, 140, 248, 0.08); }

.hero-stats {
  margin-top: 60px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.stat {
  position: relative; overflow: hidden;
  padding: 26px 26px 24px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 27, 45, 0.85), rgba(11, 17, 32, 0.95));
  box-shadow: 0 6px 22px rgba(2, 6, 17, 0.35);
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: var(--gradient); opacity: 0.85;
}
.stat:hover {
  border-color: rgba(129, 140, 248, 0.55); transform: translateY(-4px);
  box-shadow: 0 20px 46px rgba(2, 6, 17, 0.55);
}
.stat b {
  display: block; font-family: var(--font-display); font-size: clamp(46px, 4.6vw, 58px); font-weight: 700;
  line-height: 1; letter-spacing: -0.015em;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat > span { font-size: 14px; color: var(--text-muted); margin-top: 13px; display: block; line-height: 1.45; }

/* ---------- sections ---------- */
section { padding: 104px 0; position: relative; }
.sec-head { margin-bottom: 56px; }
.sec-tag {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent-1);
  letter-spacing: 0.16em; text-transform: uppercase; display: block; margin-bottom: 14px;
}
.sec-head h2 {
  font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.12;
}
.sec-head p { margin-top: 16px; color: var(--text-muted); max-width: 640px; font-size: 17px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: start; }
.about-copy p { color: var(--text-muted); margin-bottom: 20px; font-size: 17px; }
.about-copy p strong { color: var(--text); font-weight: 600; }
.quote-block {
  margin: 30px 0; padding: 26px 30px; border-left: 3px solid transparent;
  border-image: var(--gradient) 1; background: var(--surface);
  font-family: var(--font-display); font-size: 21px; line-height: 1.5;
  color: var(--text); font-weight: 500;
}
.about-facts { display: flex; flex-direction: column; gap: 12px; }
.fact {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 17px 19px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); font-size: 14.5px;
}
.fact svg { flex: 0 0 20px; margin-top: 2px; color: var(--accent-1); }
.fact b { display: block; font-weight: 600; font-size: 14.5px; }
.fact span { color: var(--text-muted); font-size: 13.5px; }

/* ---------- what i do (pillars) ---------- */
.pillars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 22px; }
.pillar {
  grid-column: span 2;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 30px 28px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.pillar:hover { border-color: var(--border-strong); transform: translateY(-3px); background: var(--surface-strong); }
.pillar:nth-child(4) { grid-column: 2 / 4; }
.pillar:nth-child(5) { grid-column: 4 / 6; }
.pillar h4 { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.pillar > p { color: var(--text-muted); font-size: 14.5px; flex-grow: 1; }
.pillar .mini-icon { margin-bottom: 2px; }
.pillar-quote {
  font-family: var(--font-mono); font-size: 12px; color: var(--accent-1);
  padding-top: 6px; border-top: 1px dashed var(--border); line-height: 1.6;
}

/* ---------- projects ---------- */
.proj-featured { display: flex; flex-direction: column; gap: 26px; }
.proj-card {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.6), rgba(11, 17, 32, 0.85));
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.proj-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 24px 60px rgba(2, 6, 17, 0.55);
}
.proj-card.alt { grid-template-columns: 1fr 1.05fr; }
.proj-card.alt .proj-art { order: 2; }
.proj-art {
  position: relative; min-height: 320px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(34, 211, 238, 0.08), transparent 55%),
              radial-gradient(120% 120% at 80% 90%, rgba(129, 140, 248, 0.1), transparent 55%),
              #0a0f1d;
  border-right: 1px solid var(--border);
  padding: 34px; overflow: hidden;
}
.proj-card.alt .proj-art { border-right: 0; border-left: 1px solid var(--border); }
.proj-art svg {
  width: 100%; height: auto; max-height: 300px;
  filter: drop-shadow(0 18px 34px rgba(2, 6, 17, 0.5));
  will-change: transform;
}
.proj-body { padding: 42px 44px; display: flex; flex-direction: column; }
.proj-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface);
}
.chip.hl { color: var(--accent-1); border-color: rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.07); }
.proj-body h3 { font-family: var(--font-display); font-size: 27px; font-weight: 700; letter-spacing: -0.015em; }
.proj-body > p { color: var(--text-muted); margin-top: 13px; font-size: 15.5px; }
.proj-points { list-style: none; margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.proj-points li { position: relative; padding-left: 24px; color: var(--text-muted); font-size: 14.5px; }
.proj-points li::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 12px; height: 2px;
  border-radius: 2px; background: var(--gradient);
}
.proj-points li b { color: var(--text); font-weight: 600; }
.proj-why {
  margin-top: 20px; padding: 13px 16px; border-radius: 12px;
  background: rgba(34, 211, 238, 0.05); border: 1px solid rgba(34, 211, 238, 0.18);
  font-size: 13.5px; color: var(--text-muted); font-style: italic;
}
.proj-why b { color: var(--accent-1); font-style: normal; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.proj-stack { margin-top: auto; padding-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
.proj-stack .chip { font-size: 11px; }

/* secondary project grid */
.proj-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.mini-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 28px 26px;
  display: flex; flex-direction: column; gap: 13px;
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.mini-card:hover { border-color: var(--border-strong); transform: translateY(-3px); background: var(--surface-strong); }
.mini-icon {
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(129, 140, 248, 0.14));
  border: 1px solid rgba(129, 140, 248, 0.25); color: var(--accent-1);
  flex: none;
}
.mini-card h4 { font-family: var(--font-display); font-size: 18.5px; font-weight: 600; }
.mini-card p { color: var(--text-muted); font-size: 14px; flex-grow: 1; }
.mini-card .proj-stack { padding-top: 4px; margin-top: 0; }

/* ---------- philosophy (scrollytelling) ---------- */
.philo { padding: 0; height: 420vh; }
.philo-sticky {
  position: sticky; top: 0; height: 100vh;
  display: flex; align-items: center; overflow: hidden;
}
.philo-sticky .wrap { width: 100%; position: relative; }
.philo-stage { position: relative; height: 320px; margin-top: 26px; }
.philo-item {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(46px) scale(0.985);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
}
.philo-item.active { opacity: 1; transform: none; }
.philo-item .num {
  font-family: var(--font-mono); font-size: 15px; margin-bottom: 18px;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 600; letter-spacing: 0.12em;
}
.philo-item h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(36px, 6vw, 66px); letter-spacing: -0.025em; line-height: 1.06;
  max-width: 880px;
}
.philo-item p {
  margin-top: 22px; font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted); max-width: 620px; line-height: 1.65;
}
.philo-dots {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 11px;
}
.philo-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(148, 163, 184, 0.25); transition: background 0.3s ease, transform 0.3s ease;
}
.philo-dots span.active { background: var(--accent-1); transform: scale(1.35); box-shadow: 0 0 10px rgba(34,211,238,0.6); }

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.skill-col {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 30px 28px;
}
.skill-col h4 {
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  display: flex; align-items: center; gap: 11px; margin-bottom: 20px;
}
.skill-col h4 svg { color: var(--accent-1); flex: none; }
.skill-col ul { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.skill-col li { color: var(--text-muted); font-size: 14.5px; display: flex; align-items: baseline; gap: 10px; }
.skill-col li::before { content: "▸"; color: var(--accent-2); font-size: 12px; }
.skill-col li b { color: var(--text); font-weight: 600; }

/* ---------- experience ---------- */
.timeline { position: relative; padding-left: 34px; max-width: 820px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2), transparent);
  opacity: 0.5;
}
.tl-item { position: relative; padding-bottom: 52px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -33px; top: 7px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg);
  border: 3px solid var(--accent-1); box-shadow: 0 0 14px rgba(34, 211, 238, 0.45);
}
.tl-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-1); letter-spacing: 0.1em; text-transform: uppercase; }
.tl-item h3 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin-top: 8px; }
.tl-item h3 span { color: var(--text-muted); font-weight: 500; }
.tl-item > p { color: var(--text-muted); font-size: 15px; margin-top: 9px; max-width: 680px; }
.tl-item .proj-points { margin-top: 14px; max-width: 680px; }
.tl-item .proj-points li { font-size: 14px; }

/* education & certifications strip */
.edu-strip {
  margin-top: 64px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 22px;
}
.edu-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 28px 30px;
}
.edu-card h4 {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-1); margin-bottom: 14px;
}
.edu-card p { font-size: 15px; color: var(--text-muted); }
.edu-card p b { color: var(--text); font-weight: 600; display: block; font-family: var(--font-display); font-size: 17px; margin-bottom: 3px; }
.cert-chips { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- contact ---------- */
.contact-card {
  border: 1px solid var(--border); border-radius: 26px; text-align: center;
  padding: 74px 40px;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(129, 140, 248, 0.13), transparent 70%),
    linear-gradient(180deg, rgba(17, 24, 39, 0.55), rgba(11, 17, 32, 0.9));
  position: relative; overflow: hidden;
}
.contact-card h2 {
  font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 700; letter-spacing: -0.02em;
}
.contact-card p { color: var(--text-muted); margin: 18px auto 36px; max-width: 500px; font-size: 17px; }
.contact-links { margin-top: 34px; display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; }
.contact-links a, .contact-links span {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 14.5px; transition: color 0.2s ease;
}
.contact-links a:hover { color: var(--text); }
.contact-links svg { color: var(--accent-1); }

/* ---------- footer ---------- */
footer { padding: 34px 0 44px; border-top: 1px solid var(--border); }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
footer p { color: var(--text-faint); font-size: 13.5px; }
footer .foot-mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- reveal animation system ---------- */
.reveal, .reveal-left, .reveal-right, .reveal-scale {
  opacity: 0; transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}
.reveal { transform: translateY(34px); }
.reveal-left { transform: translateX(-56px); }
.reveal-right { transform: translateX(56px); }
.reveal-scale { transform: translateY(30px) scale(0.955); }
.reveal.visible, .reveal-left.visible, .reveal-right.visible, .reveal-scale.visible {
  opacity: 1; transform: none;
}
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }
/* staggered children */
.stagger > * {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.stagger.visible > * { opacity: 1; transform: none; }
.stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger.visible > *:nth-child(2) { transition-delay: 0.09s; }
.stagger.visible > *:nth-child(3) { transition-delay: 0.18s; }
.stagger.visible > *:nth-child(4) { transition-delay: 0.27s; }
.stagger.visible > *:nth-child(5) { transition-delay: 0.36s; }
.stagger.visible > *:nth-child(6) { transition-delay: 0.45s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-left, .reveal-right, .reveal-scale, .stagger > * {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .hero-kicker .pulse { animation: none; }
  .philo { height: auto; padding: 104px 0; }
  .philo-sticky { position: static; height: auto; }
  .philo-stage { height: auto; margin-top: 40px; display: flex; flex-direction: column; gap: 56px; }
  .philo-item { position: static; opacity: 1; transform: none; pointer-events: auto; }
  .philo-dots { display: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .proj-card, .proj-card.alt { grid-template-columns: 1fr; }
  .proj-card.alt .proj-art { order: 0; }
  .proj-art, .proj-card.alt .proj-art { border-right: 0; border-left: 0; border-bottom: 1px solid var(--border); min-height: 260px; }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .pillar, .pillar:nth-child(4), .pillar:nth-child(5) { grid-column: auto; }
  .edu-strip { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .hero { padding: 138px 0 80px; }
  section { padding: 76px 0; }
  .proj-grid { grid-template-columns: 1fr; }
  .proj-body { padding: 32px 26px; }
  .pillars { grid-template-columns: 1fr; }
  .nav-links {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 12px 28px 20px;
    background: rgba(7, 11, 20, 0.97); border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links li { padding: 11px 0; }
  .nav-burger { display: block; }
  .nav-cta { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 22px 18px; }
  .stat b { font-size: 40px; }
  .quote-block { font-size: 18px; padding: 20px 22px; }
  .philo { height: 380vh; }
  .philo-stage { height: 380px; }
  .philo-dots { right: 12px; }
  .reveal-left, .reveal-right { transform: translateY(34px); }
  .edu-strip { margin-top: 44px; }
}

/* ============================================================
   v3 — Qlari technology showcase + ambient motion
   ============================================================ */

/* ---------- aurora canvas (ambient "video" backgrounds) ---------- */
.aurora {
  position: absolute; inset: 0; width: 100%; height: 100%;
  filter: blur(70px); opacity: 0.55; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .aurora { display: none; } }

/* ---------- shimmer headline accent ---------- */
.shimmer {
  background: linear-gradient(110deg, var(--accent-1), var(--accent-2) 40%, var(--accent-3) 60%, var(--accent-1) 80%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer { to { background-position: -220% center; } }
@media (prefers-reduced-motion: reduce) { .shimmer { animation: none; } }

/* ---------- showcase section ---------- */
.showcase { position: relative; overflow: hidden; }
.showcase-bg { position: absolute; inset: 0; pointer-events: none; }
.showcase .wrap { position: relative; }
.show-blocks { display: flex; flex-direction: column; gap: 30px; }
.show-block {
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 0;
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.6), rgba(11, 17, 32, 0.85));
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.show-block:hover { border-color: var(--border-strong); box-shadow: 0 24px 60px rgba(2, 6, 17, 0.55); }
.show-block.alt { grid-template-columns: 1.05fr 1fr; }
.show-block.alt .show-art { order: 2; }
.show-art {
  position: relative; min-height: 340px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(34, 211, 238, 0.08), transparent 55%),
              radial-gradient(120% 120% at 80% 90%, rgba(129, 140, 248, 0.1), transparent 55%),
              #0a0f1d;
  border-right: 1px solid var(--border);
  padding: 34px; overflow: hidden;
  transition: transform 0.25s ease;
  will-change: transform;
}
.show-block.alt .show-art { border-right: 0; border-left: 1px solid var(--border); }
.show-art svg { width: 100%; height: auto; max-height: 320px; filter: drop-shadow(0 18px 34px rgba(2, 6, 17, 0.5)); }
.show-body { padding: 44px 46px; display: flex; flex-direction: column; }
.show-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent-1); margin-bottom: 16px;
}
.show-body h3 {
  font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700; letter-spacing: -0.018em; line-height: 1.18;
}
.show-body > p { color: var(--text-muted); margin-top: 14px; font-size: 15.5px; }
.show-body .proj-points { margin-top: 22px; }
.show-body .proj-why { margin-top: 22px; }
.show-ground { margin-top: auto; padding-top: 26px; }
.show-ground b {
  display: block; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 10px; font-weight: 600;
}
.show-ground .chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* deep-dive link on the Qlari card */
.proj-more {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 18px; font-size: 14px; font-weight: 600; color: var(--accent-1);
  transition: gap 0.2s ease, color 0.2s ease;
}
.proj-more:hover { gap: 11px; color: var(--text); }

/* ---------- animated SVG art: shared ---------- */
.show-art svg * { transform-box: fill-box; }

/* --- brief assembly --- */
.b-sec { opacity: 0; animation: briefSec 13s ease-in-out infinite; }
.b-sec-2 { animation-delay: 0.7s; }
.b-sec-3 { animation-delay: 1.4s; }
.b-sec-4 { animation-delay: 2.1s; }
@keyframes briefSec {
  0% { opacity: 0; transform: translateX(26px); }
  5%, 88% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; transform: translateX(26px); }
}
.cite { animation: citePulse 2.6s ease-in-out infinite; }
.cite-2 { animation-delay: 0.9s; }
.cite-3 { animation-delay: 1.7s; }
@keyframes citePulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.stamp { opacity: 0; transform-origin: 50% 50%; animation: stampIn 13s ease-in-out infinite; }
@keyframes stampIn {
  0%, 26% { opacity: 0; transform: scale(1.5) rotate(-8deg); }
  31%, 88% { opacity: 1; transform: scale(1) rotate(-8deg); }
  95%, 100% { opacity: 0; }
}

/* --- radar scan --- */
.scanline { animation: scanX 5.5s ease-in-out infinite alternate; }
@keyframes scanX { from { transform: translateX(0); } to { transform: translateX(316px); } }
.blip { animation: blipPulse 5.5s ease-in-out infinite; }
.blip-2 { animation-delay: 0.6s; } .blip-3 { animation-delay: 1.2s; }
.blip-4 { animation-delay: 1.8s; } .blip-5 { animation-delay: 2.4s; }
.blip-6 { animation-delay: 3s; }  .blip-7 { animation-delay: 3.6s; }
@keyframes blipPulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.blip-ring { transform-origin: 50% 50%; animation: ringPulse 2.8s ease-out infinite; }
@keyframes ringPulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  70%, 100% { transform: scale(1.6); opacity: 0; }
}

/* --- chart builder --- */
.cursor { animation: cursorBlink 1.1s steps(1) infinite; }
@keyframes cursorBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.bar-a { transform-origin: 50% 100%; animation: barGrow 8s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
.bar-a2 { animation-delay: 0.25s; } .bar-a3 { animation-delay: 0.5s; }
.bar-a4 { animation-delay: 0.75s; } .bar-a5 { animation-delay: 1s; }
.bar-a6 { animation-delay: 1.25s; }
@keyframes barGrow {
  0% { transform: scaleY(0); }
  10%, 86% { transform: scaleY(1); }
  94%, 100% { transform: scaleY(0); }
}
.trend-draw { stroke-dasharray: 420; stroke-dashoffset: 420; animation: trendDraw 8s ease-in-out infinite; }
@keyframes trendDraw {
  0%, 12% { stroke-dashoffset: 420; }
  40%, 86% { stroke-dashoffset: 0; }
  94%, 100% { stroke-dashoffset: 420; }
}
.pub { opacity: 0; animation: pubIn 8s ease-in-out infinite; }
@keyframes pubIn {
  0%, 42% { opacity: 0; transform: translateY(8px); }
  50%, 86% { opacity: 1; transform: none; }
  94%, 100% { opacity: 0; }
}

/* --- ambient pulses reusable on existing art --- */
.pulse-dot { animation: dotPulse 2.4s ease-in-out infinite; }
.pulse-dot-2 { animation-delay: 0.8s; } .pulse-dot-3 { animation-delay: 1.6s; }
@keyframes dotPulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .b-sec, .cite, .stamp, .scanline, .blip, .blip-ring,
  .cursor, .bar-a, .trend-draw, .pub, .pulse-dot { animation: none; opacity: 1; }
  .trend-draw { stroke-dashoffset: 0; }
  .stamp { transform: rotate(-8deg); }
}

/* ---------- showcase responsive ---------- */
@media (max-width: 980px) {
  .show-block, .show-block.alt { grid-template-columns: 1fr; }
  .show-block.alt .show-art { order: 0; }
  .show-art, .show-block.alt .show-art {
    border-right: 0; border-left: 0; border-bottom: 1px solid var(--border); min-height: 280px;
  }
}
@media (max-width: 640px) {
  .show-body { padding: 32px 26px; }
}

/* ---------- originality statement ---------- */
.build-note {
  display: flex; align-items: flex-start; gap: 13px;
  margin-top: 26px; padding: 15px 20px;
  border: 1px solid rgba(34, 211, 238, 0.3); border-radius: 14px;
  background: rgba(34, 211, 238, 0.05);
  font-size: 15px; color: var(--text-muted); max-width: 680px;
}
.build-note svg { color: var(--accent-1); flex: none; margin-top: 2px; }
.build-note b { color: var(--text); font-weight: 600; }

/* ============================================================
   v4 — app gallery + per-product detail pages
   ============================================================ */

/* ---------- homepage gallery ---------- */
.gallery-label {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 8px 0 20px; display: flex; align-items: center; gap: 14px;
}
.gallery-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.gallery-label:not(:first-of-type) { margin-top: 52px; }
.gallery {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.app-card {
  display: flex; flex-direction: column; gap: 13px;
  padding: 26px 24px 22px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20, 27, 45, 0.6), rgba(11, 17, 32, 0.85));
  position: relative; overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.app-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 80% at 50% -10%, rgba(129, 140, 248, 0.12), transparent 60%);
  opacity: 0; transition: opacity 0.3s ease;
}
.app-card:hover {
  border-color: var(--border-strong); transform: translateY(-5px);
  box-shadow: 0 22px 50px rgba(2, 6, 17, 0.55); background: var(--surface-strong);
}
.app-card:hover::before { opacity: 1; }
.app-card-icon {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(129, 140, 248, 0.16));
  border: 1px solid rgba(129, 140, 248, 0.3); color: var(--accent-1);
  position: relative; z-index: 1;
}
.app-card-cat {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-1); position: relative; z-index: 1;
}
.app-card-name {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  letter-spacing: -0.01em; position: relative; z-index: 1;
}
.app-card-desc {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.5;
  flex-grow: 1; position: relative; z-index: 1;
}
.app-card-go {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--accent-1);
  position: relative; z-index: 1; transition: gap 0.2s ease;
}
.app-card:hover .app-card-go { gap: 11px; }

/* ---------- product detail page ---------- */
.proj-hero { padding: 128px 0 40px; position: relative; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  margin-bottom: 34px; transition: color 0.2s ease, gap 0.2s ease;
}
.back-link:hover { color: var(--text); gap: 12px; }
.proj-hero-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
}
.proj-hero-copy .proj-meta { margin-bottom: 20px; }
.proj-hero-copy h1 {
  font-family: var(--font-hero); font-size: clamp(34px, 5vw, 56px);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.05;
}
.proj-lede {
  margin-top: 20px; font-size: 19px; line-height: 1.6; color: var(--text-muted);
}
.proj-role {
  margin-top: 24px; font-size: 14px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.proj-role b { color: var(--text); font-weight: 600; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.proj-hero-art {
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: radial-gradient(120% 120% at 30% 20%, rgba(34, 211, 238, 0.08), transparent 55%),
              radial-gradient(120% 120% at 80% 90%, rgba(129, 140, 248, 0.1), transparent 55%),
              #0a0f1d;
  padding: 30px;
}
.proj-hero-art svg { width: 100%; height: auto; filter: drop-shadow(0 18px 34px rgba(2, 6, 17, 0.5)); }

.proj-doc { padding: 40px 0 90px; }
.proj-doc .wrap { max-width: 900px; }
.detail-section { margin-top: 52px; }
.detail-section:first-child { margin-top: 0; }
.detail-lead { font-size: 18px; line-height: 1.75; color: var(--text-muted); }
.detail-lead strong { color: var(--text); font-weight: 600; }
.detail-section h2 {
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  letter-spacing: -0.015em; margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px;
}
.detail-section h2::before {
  content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--gradient); flex: none;
}
.spec-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.spec-list li {
  position: relative; padding-left: 26px; color: var(--text-muted);
  font-size: 15.5px; line-height: 1.6;
}
.spec-list li::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 13px; height: 2px;
  border-radius: 2px; background: var(--gradient);
}
.spec-list li b { color: var(--text); font-weight: 600; }
.detail-why {
  margin-top: 52px; padding: 28px 32px; border-radius: 18px;
  background: rgba(34, 211, 238, 0.05); border: 1px solid rgba(34, 211, 238, 0.2);
  font-size: 18px; line-height: 1.6; color: var(--text);
}
.detail-why b {
  display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-1); margin-bottom: 10px; font-weight: 600;
}
.detail-stack { margin-top: 44px; }
.detail-stack b {
  display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; font-weight: 600;
}
.detail-stack .chips { display: flex; gap: 9px; flex-wrap: wrap; }

/* embedded showcase blocks (Qlari) inherit .show-block styles already defined */
.proj-doc .show-blocks { margin-top: 30px; }

/* prev / next pager */
.proj-pager {
  max-width: 900px; margin: 0 auto; padding: 0 28px 90px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
.pager-link {
  border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px;
  background: var(--surface); transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
  display: flex; flex-direction: column; gap: 6px;
}
.pager-link:hover { border-color: var(--border-strong); transform: translateY(-3px); background: var(--surface-strong); }
.pager-link.next { text-align: right; }
.pager-link .dir { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-1); }
.pager-link .pname { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text); }

@media (max-width: 900px) {
  .gallery, .gallery.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .proj-hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .proj-hero-art { order: -1; }
  .proj-hero { padding: 108px 0 20px; }
}
@media (max-width: 560px) {
  .gallery, .gallery.cols-3 { grid-template-columns: 1fr; }
  .proj-pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: left; }
}
