:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --bg-3: #1a1a1a;
  --line: #2a2a2a;
  --text: #f3f3f3;        /* text chính — contrast cao hơn để đọc lâu không mỏi */
  --muted: #a8a8a8;       /* text phụ (mô tả dài) */
  --muted-2: #777777;     /* text rất phụ — chỉ dùng cho metadata ngắn */
  --accent: #c6ff00;      /* accent neon chính */
  --accent-dim: #9bbf00;
  --accent-mentor: #5efce8; /* accent riêng cho gói Mentor */
  --warn: #ff6b35;
  --info: #5eead4;
  --danger: #ff6b6b;
}

* { -webkit-font-smoothing: antialiased; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-feature-settings: "ss01", "cv11";
  margin: 0;
}
a { color: inherit; text-decoration: none; }
.serif { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -0.02em; }
.mono { font-family: 'JetBrains Mono', monospace; }
.accent { color: var(--accent); }
.bg-accent { background: var(--accent); }
.text-muted { color: var(--muted); }
.border-line { border-color: var(--line); }

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}
main, header, footer { position: relative; z-index: 2; }

.grid-bg {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
}

.cursor::after {
  content: '_';
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.stage-card {
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.stage-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.stage-card:hover .stage-num { color: var(--accent); }

.marquee-wrap { overflow: hidden; padding: 8px 0; background: #0d0d0d; border-bottom: 1px solid var(--line); }
.marquee {
  display: flex;
  gap: 3rem;
  animation: marquee 40s linear infinite;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
}
@keyframes marquee { to { transform: translateX(-50%); } }

.glow { box-shadow: 0 0 80px -20px var(--accent); }

.code-block {
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
}
.code-header {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #141414;
}
.code-dot { width: 10px; height: 10px; border-radius: 50%; }

.price-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 32px;
}
.price-card.featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(212,255,0,0.04) 0%, #0a0a0a 100%);
}
.price-card:hover { transform: translateY(-2px); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.hero-line { display: block; overflow: hidden; }
.hero-line span { display: inline-block; animation: rise 1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; transform: translateY(110%); }
.hero-line:nth-child(1) span { animation-delay: 0.1s; }
.hero-line:nth-child(2) span { animation-delay: 0.25s; }
.hero-line:nth-child(3) span { animation-delay: 0.4s; }
@keyframes rise { to { transform: translateY(0); } }

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tag.active { border-color: var(--accent); color: var(--accent); }
.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.free-stamp {
  transform: rotate(-8deg);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 4px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.1em;
  display: inline-block;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: #fff; transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  padding: 14px 24px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background: transparent;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Lesson content */
.lesson-content {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}
.lesson-content h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 36px;
  margin: 48px 0 16px;
  letter-spacing: -0.02em;
}
.lesson-content h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  margin: 32px 0 12px;
}
.lesson-content p { margin: 16px 0; }
.lesson-content ul, .lesson-content ol { margin: 16px 0; padding-left: 24px; }
.lesson-content li { margin: 8px 0; }
.lesson-content code:not(.hljs) {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  color: var(--accent);
}
.lesson-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(212,255,0,0.3);
}
.lesson-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 24px;
  margin: 24px 0;
  color: var(--muted);
  font-style: italic;
}
.lesson-content img { max-width: 100%; border-radius: 8px; margin: 24px 0; border: 1px solid var(--line); }
.lesson-content hr { border: none; border-top: 1px solid var(--line); margin: 48px 0; }
.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}
.lesson-content th, .lesson-content td {
  padding: 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.lesson-content th { background: var(--bg-2); font-family: 'JetBrains Mono', monospace; font-size: 0.85em; text-transform: uppercase; }

.code-block-rendered {
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
}
.code-block-rendered code { background: transparent; color: var(--text); padding: 0; }

/* Utility */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 800px; margin: 0 auto; padding: 0 24px; }

/* Stage description (markdown rendered) */
.stage-desc { font-size: 16px; line-height: 1.7; }
.stage-desc p { margin: 0 0 14px; }
.stage-desc p:last-child { margin-bottom: 0; }
.stage-desc h1, .stage-desc h2, .stage-desc h3, .stage-desc h4 {
  font-family: 'Instrument Serif', serif;
  color: var(--text);
  margin: 20px 0 8px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.stage-desc h1 { font-size: 28px; }
.stage-desc h2 { font-size: 24px; }
.stage-desc h3 { font-size: 20px; }
.stage-desc h4 { font-size: 17px; }
.stage-desc strong { color: var(--text); font-weight: 600; }
.stage-desc em { font-style: italic; color: var(--text); }
.stage-desc ul, .stage-desc ol { margin: 8px 0 14px; padding-left: 22px; }
.stage-desc li { margin-bottom: 6px; }
.stage-desc li::marker { color: var(--accent); }
.stage-desc a { color: var(--accent); text-decoration: underline; }
.stage-desc code { background: var(--bg-2); padding: 1px 6px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; font-size: 0.9em; color: var(--accent); }
.stage-desc blockquote { border-left: 2px solid var(--accent); padding-left: 14px; margin: 14px 0; color: var(--text); }

/* Compact stage description (homepage cards) */
.stage-desc-card p { margin: 0 0 8px; }
.stage-desc-card p:last-child { margin-bottom: 0; }
.stage-desc-card h1, .stage-desc-card h2, .stage-desc-card h3, .stage-desc-card h4 {
  font-family: 'Instrument Serif', serif;
  color: var(--text);
  margin: 10px 0 4px;
  font-size: 16px;
  font-weight: 400;
}
.stage-desc-card strong { color: var(--text); font-weight: 600; }
.stage-desc-card ul, .stage-desc-card ol { margin: 4px 0 8px; padding-left: 18px; }
.stage-desc-card li { margin-bottom: 2px; }
.stage-desc-card li::marker { color: var(--accent); }
.stage-desc-card code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; font-size: 0.85em; color: var(--accent); }

/* Stage row (homepage horizontal layout) */
.stage-row .stage-num { transition: color 0.3s; }
.stage-row:hover .stage-num { color: var(--accent); }
@media (max-width: 720px) {
  .stage-row {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .stage-row > div:last-child {
    flex-direction: row !important;
    align-items: flex-start !important;
  }
}

/* Description clamp với gradient fade — dùng cho cả homepage roadmap và /lessons */
.stage-desc-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}
.stage-desc-collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--bg-2));
  pointer-events: none;
}
.desc-toggle-btn:hover { opacity: 0.7; }
/* ============================================================
   NÂNG CẤP: mobile-first, accessibility, floating CTA, hamburger
   ============================================================ */

/* --- Accessibility: focus rõ ràng cho người dùng bàn phím --- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Reduced motion: tôn trọng người dùng tắt hiệu ứng --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .marquee { animation: none !important; }
  .hero-line span { transform: none !important; }
  .cursor::after { animation: none !important; }
}

/* --- Text phụ rất mờ chỉ dùng cho metadata --- */
.text-muted-2 { color: var(--muted-2); }
.accent-mentor { color: var(--accent-mentor); }

/* --- Sticky header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

/* --- Nav link hover (thay cho inline onmouseover) --- */
.nav-link { transition: color 0.15s ease; }
.nav-link:hover { color: var(--accent); }

/* --- Hamburger (mobile menu) --- */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  line-height: 1;
}

/* --- Section helper --- */
.section-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* --- Card chuẩn hoá --- */
.card-std {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card-std:hover { border-color: rgba(198,255,0,0.35); }

/* --- FAQ details --- */
.faq-item { border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.faq-item summary {
  cursor: pointer; font-weight: 500; font-size: 16px; list-style: none;
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .faq-plus { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 20px; transition: transform 0.2s ease; }
.faq-item[open] summary .faq-plus { transform: rotate(45deg); }
.faq-item .faq-body { padding: 0 20px 18px; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* --- Floating Zalo CTA (mọi trang, nổi bật trên mobile) --- */
.zalo-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #000;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 28px -8px rgba(198,255,0,0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.zalo-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -8px rgba(198,255,0,0.8); }
.zalo-fab .zalo-fab-label { white-space: nowrap; }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 860px) {
  /* Hamburger hiện, nav thu vào panel dọc */
  .nav-toggle { display: inline-flex; }
  #main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0 !important;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  #main-nav.open { display: flex; }
  #main-nav a {
    padding: 12px 24px;
    border-top: 1px solid var(--line);
  }
  .site-header .container { position: relative; }
}

@media (max-width: 720px) {
  /* Grid nhiều cột → 1 cột trên mobile */
  .grid-auto,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }
  /* CTA full-width, xếp dọc */
  .cta-group { flex-direction: column; align-items: stretch; }
  .cta-group > a { justify-content: center; width: 100%; box-sizing: border-box; }
  /* Section padding gọn hơn */
  main section { padding-top: 56px !important; padding-bottom: 56px !important; }
  /* Nút chạm ≥ 44px */
  .btn-primary, .btn-ghost { min-height: 44px; }
  /* Ẩn label dài của Zalo FAB, chỉ giữ icon cho gọn */
  .zalo-fab { padding: 12px; }
  .zalo-fab .zalo-fab-label { display: none; }
  /* Footer 2 cột thay vì 4 */
  .footer-cols { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 460px) {
  .footer-cols { grid-template-columns: 1fr !important; }
  .container, .container-narrow { padding: 0 18px; }
}

/* Production-reality table → stack trên mobile */
@media (max-width: 760px) {
  .prod-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .step-row { grid-template-columns: 48px 1fr !important; }
  .step-row > div:nth-child(2) { grid-column: 2; }
}
