/* ══════════════════════════════════════════════════════════════════
   Groot3 — trang giới thiệu
   Đổi thương hiệu: sửa các biến trong :root là xong.
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* Nền — trung tính lệch xanh lam-lục cho hợp với teal */
  --bg:        #141618;
  --bg-2:      #191c1f;
  --panel:     #1e2124;
  --panel-2:   #23272b;
  --line:      #2e3338;
  --line-soft: #24282c;

  /* Chữ */
  --tx:      #e6e9ec;
  --tx-mid:  #b3bac1;
  --tx-dim:  #8b949e;

  /* Màu chức năng — lấy thẳng từ app */
  --accent: #4ec9b0;   /* Action / nhấn chính */
  --run:    #e5a93d;   /* đang chạy */
  --fail:   #e24b4a;   /* thất bại */
  --ctrl:   #4a9fe0;   /* điều hướng */
  --dec:    #9b6bcc;   /* decorator */
  --cond:   #c8cdd4;   /* điều kiện */
  --sub:    #d81b8e;   /* subtree */
  --code:   #9cdcfe;

  /* Chữ */
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Nhịp */
  --r:    10px;
  --r-sm: 6px;
  --gap:  clamp(1rem, 2.5vw, 1.6rem);
  --pad-sect: clamp(3.5rem, 9vw, 7rem);
  --wrap: 1180px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ── Reset gọn ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  font-size: clamp(15px, 0.55vw + 13.6px, 17px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0; top: -60px; z-index: 100;
  background: var(--accent); color: #0d1114;
  padding: .6rem 1rem; font-weight: 600; text-decoration: none;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 0; }

.wrap {
  width: min(100% - 2.4rem, var(--wrap));
  margin-inline: auto;
}

/* ── Chữ ───────────────────────────────────────────────────────── */
h1, h2, h3 { text-wrap: balance; line-height: 1.15; font-weight: 650; }

h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.7rem);
  letter-spacing: -0.025em;
  margin-bottom: 1.1rem;
}
h1 em {
  font-style: normal;
  color: var(--accent);
}

h2 {
  font-size: clamp(1.55rem, 3.4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 2.2rem;
}

h3 { font-size: 1.06rem; letter-spacing: -0.01em; margin-bottom: .45rem; }

p { max-width: 68ch; }

.eyebrow {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .9rem;
}

.lede { color: var(--tx-mid); font-size: 1.06rem; }

code {
  font-family: var(--mono);
  font-size: .88em;
  color: var(--code);
  background: #16222d;
  padding: .1em .42em;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Nút ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .7rem 1.35rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: .93rem;
  text-decoration: none; cursor: pointer;
  transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--accent); color: #0c1214; }
.btn--primary:hover { background: #63d9c1; }

.btn--ghost { border-color: var(--line); color: var(--tx); background: transparent; }
.btn--ghost:hover { border-color: #454c53; background: var(--panel); }

.btn--sm { padding: .42rem .95rem; font-size: .85rem; }

/* ── Nav ───────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 22, 24, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav__inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; font-weight: 650; letter-spacing: -0.02em;
  margin-right: auto;
}
.brand__text { font-size: 1.08rem; }
.brand__text b { color: var(--accent); font-weight: 650; }

/* Dấu hiệu: ba nhánh toả xuống — hình cây thu nhỏ */
.brand__mark {
  display: grid; grid-template-columns: repeat(3, 4px); gap: 3px;
  align-items: end; height: 16px;
}
.brand__mark span {
  display: block; width: 4px; border-radius: 2px; background: var(--ctrl);
}
.brand__mark span:nth-child(1) { height: 8px;  background: var(--accent); }
.brand__mark span:nth-child(2) { height: 16px; }
.brand__mark span:nth-child(3) { height: 11px; background: var(--sub); }

.nav__menu {
  display: flex; align-items: center; gap: 1.5rem;
  font-size: .92rem;
}
.nav__menu a { text-decoration: none; color: var(--tx-mid); transition: color .15s var(--ease); }
.nav__menu a:hover { color: var(--tx); }
.nav__menu a.btn { color: #0c1214; }

.nav__toggle {
  display: none;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-sm); width: 40px; height: 36px;
  cursor: pointer; align-items: center; justify-content: center;
}
.nav__bars, .nav__bars::before, .nav__bars::after {
  display: block; width: 16px; height: 2px; border-radius: 2px;
  background: var(--tx); position: relative;
}
.nav__bars::before, .nav__bars::after { content: ""; position: absolute; left: 0; }
.nav__bars::before { top: -5px; }
.nav__bars::after  { top: 5px; }

@media (max-width: 760px) {
  .nav__toggle { display: inline-flex; }
  .nav__menu {
    position: absolute; inset: 4rem .8rem auto .8rem;
    flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: .6rem;
    box-shadow: 0 18px 40px rgba(0,0,0,.5);
    display: none;
  }
  .nav__menu.is-open { display: flex; }
  .nav__menu a { padding: .6rem .7rem; border-radius: var(--r-sm); }
  .nav__menu a:hover { background: var(--panel-2); }
  .nav__menu a.btn { justify-content: center; margin-top: .35rem; }
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem); }

.hero__grid {
  display: grid; gap: clamp(2rem, 5vw, 3.4rem);
  /* minmax(0,…) chứ không phải 1fr: cây bên trong dùng nowrap, để mặc định
     min-width:auto thì nó nong cột rộng ra và đẩy cả trang trôi ngang. */
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
.hero__copy, .hero__demo { min-width: 0; }
@media (min-width: 980px) {
  .hero__grid { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
}

.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.7rem; }

.hero__facts {
  display: flex; flex-wrap: wrap; gap: 1.8rem;
  list-style: none; padding: 0; margin-top: 2.2rem;
  border-top: 1px solid var(--line-soft); padding-top: 1.2rem;
}
.hero__facts li { display: flex; flex-direction: column; }
.hero__facts b {
  font-family: var(--mono); font-size: 1.15rem; color: var(--accent);
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.hero__facts span { font-size: .8rem; color: var(--tx-dim); }

/* ── Khung cửa sổ giả lập ──────────────────────────────────────── */
.win {
  margin: 0;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

.win__bar {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .8rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.win__dots { display: flex; gap: 5px; }
.win__dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a4046; }
.win__title {
  font-family: var(--mono); font-size: .76rem; color: var(--tx-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-right: auto;
}
.win__play {
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-sm); width: 28px; height: 24px;
  cursor: pointer; color: var(--tx-mid); font-size: .78rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.win__play:hover { border-color: var(--accent); color: var(--accent); }

/* Cây: cuộn ngang trong chính nó, không đẩy trang */
.tree {
  padding: .55rem .4rem .7rem;
  overflow-x: auto;
  font-size: .8rem;
}

.row {
  display: flex; align-items: center; gap: .38rem;
  padding: .17rem .5rem .17rem 0;
  margin-left: calc(var(--d) * 15px);
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background .3s var(--ease);
}
.row.is-run { background: rgba(229, 169, 61, .1); }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4b5259; flex: none;
  transition: background .25s var(--ease), box-shadow .25s var(--ease);
}
.is-run  .dot, .dot.is-run  { background: var(--run);    box-shadow: 0 0 0 3px rgba(229,169,61,.18); }
.is-ok   .dot, .dot.is-ok   { background: var(--accent); }
.is-fail .dot, .dot.is-fail { background: var(--fail);   }

.gl { font-size: .82rem; flex: none; width: 1rem; text-align: center; }
.em { font-size: .82rem; flex: none; }

.chip {
  font-size: .62rem; font-weight: 700; letter-spacing: .01em;
  padding: .06rem .38rem; border-radius: 4px;
  color: #14181d; flex: none;
}
.chip--root { background: #9aa0a6; }
.chip--ctrl { background: var(--ctrl); }
.chip--dec  { background: var(--dec); color: #f2ecfa; }
.chip--cond { background: var(--cond); }
.chip--act  { background: var(--accent); }
.chip--sub  { background: var(--sub); color: #ffe6f3; }

.nm { font-weight: 600; font-size: .76rem; flex: none; }

.row code {
  font-size: .68rem; padding: .05rem .35rem;
  background: #16222d;
}

.badge {
  font-size: .6rem; font-weight: 600;
  color: #c4ac74; background: #302a17;
  border: 1px solid #5c4f2c; border-radius: 4px;
  padding: 0 .32rem; flex: none;
}

/* Vạch + số ưu tiên: nóng → nguội */
.p  { width: 3px; height: 15px; border-radius: 2px; flex: none; margin-right: .1rem; }
.pn {
  font-size: .58rem; font-weight: 700; border: 1px solid; border-radius: 3px;
  padding: 0 .26rem; flex: none; background: transparent;
}
.p0 { background: var(--fail);  border-color: var(--fail);  color: var(--fail); }
.p1 { background: #e0883d;      border-color: #e0883d;      color: #e0883d; }
.p2 { background: #e5c93d;      border-color: #e5c93d;      color: #e5c93d; }
.p3 { background: var(--ctrl);  border-color: var(--ctrl);  color: var(--ctrl); }
.pn.p0, .pn.p1, .pn.p2, .pn.p3 { background: transparent; }

.win__foot {
  display: flex; flex-wrap: wrap; gap: .9rem;
  padding: .5rem .85rem;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  font-size: .7rem; color: var(--tx-dim);
}
.lg { display: inline-flex; align-items: center; gap: .35rem; }

/* ── Khối nội dung ─────────────────────────────────────────────── */
.sect { padding: var(--pad-sect) 0; }
.sect--alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }

/* ── Đối chiếu ─────────────────────────────────────────────────── */
.split {
  display: grid; gap: var(--gap);
  grid-template-columns: 1fr;
}
@media (min-width: 860px) { .split { grid-template-columns: 1fr 1fr; } }

.split__col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1.2rem, 3vw, 1.8rem);
}
.split__col h3 { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; }
.split__col h3 span {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; flex: none;
}
.split__col--bad  h3 span { background: rgba(226,75,74,.16);  color: var(--fail); }
.split__col--good h3 span { background: rgba(78,201,176,.16); color: var(--accent); }

.split__col--good { border-color: rgba(78,201,176,.32); }

.split__col ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .6rem; }
.split__col li { color: var(--tx-mid); font-size: .95rem; }
.split__col--bad li::marker  { color: #5a6169; }
.split__col--good li::marker { color: var(--accent); }

/* ── Thẻ tính năng ─────────────────────────────────────────────── */
.cards {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.4rem;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: #454c53; transform: translateY(-2px); }
.card--hl { border-color: rgba(78,201,176,.38); background: linear-gradient(var(--panel), var(--panel)) padding-box; }
.card__ico { font-size: 1.3rem; display: block; margin-bottom: .75rem; }
.card p { color: var(--tx-dim); font-size: .92rem; }

/* ── Ba bước ───────────────────────────────────────────────────── */
.steps { list-style: none; padding: 0; display: grid; gap: 1.1rem; counter-reset: s; }
.step {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 1.15rem 1.3rem;
}
.step__n {
  font-family: var(--mono); font-weight: 700; font-size: 1rem;
  color: var(--accent);
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(78,201,176,.11); border-radius: 50%;
}
.step p { color: var(--tx-dim); font-size: .94rem; }

/* ── Bảng thông số ─────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.spec { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--panel); }
.spec th, .spec td { text-align: left; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.spec th { color: var(--tx-dim); font-weight: 500; white-space: nowrap; width: 1%; }
.spec td { color: var(--tx-mid); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); }

/* ── Kêu gọi cuối ──────────────────────────────────────────────── */
.cta__inner { text-align: center; display: grid; justify-items: center; }
.cta h2 { margin-bottom: 1rem; }
.cta .hero__cta { justify-content: center; }
.fineprint { color: var(--tx-dim); font-size: .8rem; margin-top: 1.4rem; }

/* ── Chân trang ────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line-soft); padding: 2.2rem 0; }
.foot__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.2rem;
}
.foot p { color: var(--tx-dim); font-size: .86rem; }

/* ── Tôn trọng người tắt hiệu ứng ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
