/* ============================================================
   ViFast — giao diện kem ấm, điểm nhấn đỏ
   Chỉ dùng font hệ thống; không font ngoài, không CDN.
   ============================================================ */

:root {
  --bg: #FFF8EC; --card: #FFFCF7; --text: #3B2A22; --muted: #7A6558;
  --accent: #C0392B; --accent-2: #E5352B; --accent-strong: #A93226; --border: #EADBCC;
  --radius: 16px; --max: 1180px;
  /* Latinh/Việt trước, không đặt system-ui lên đầu: trên máy Windows/macOS
     bản Nhật–Trung–Hàn, system-ui trỏ vào font CJK và dấu tiếng Việt
     (ầ ế ộ ữ) bị tách rời. Các font dưới đây đều phủ đủ tiếng Việt. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Helvetica, Arial, "Noto Sans", "Liberation Sans", "DejaVu Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "DejaVu Sans Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 4px;
}

::selection { background: #F3D9D4; color: var(--text); }

/* Tiện ích chung ------------------------------------------------ */
.topline {
  height: 5px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 62%, #F5A300 62%, #F5A300 100%);
}

.container {
  width: min(var(--max), calc(100% - 48px)); max-width: none;
  margin-inline: auto; padding-inline: 0;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 50; padding: 8px 14px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 600; transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

[hidden] { display: none !important; }

/* Đầu trang ----------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 248, 236, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 70px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 18px; font-weight: 700;
  letter-spacing: -.01em;
}

.brand__mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 800; transition: background-color .18s ease;
}
.brand:hover { color: var(--accent); }
.brand:hover .brand__mark { background: var(--accent-strong); }

.site-nav__list {
  display: flex; align-items: center; gap: 26px;
  margin: 0; padding: 0; list-style: none;
}
.site-nav a {
  color: var(--muted); font-size: 14px; font-weight: 600;
  transition: color .18s ease;
}
.site-nav a:hover { color: var(--accent); }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .18s ease, background-color .18s ease;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { position: absolute; left: 0; content: ""; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

.site-header.is-open .nav-toggle__bars { background: transparent; }
.site-header.is-open .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.site-header.is-open .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Hero ---------------------------------------------------------- */
.hero { position: relative; padding: 54px 0 44px; overflow: hidden; }

.eyebrow {
  margin: 0 0 14px; color: var(--accent); font-size: 13px;
  font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}

.hero h1 {
  max-width: 820px; margin: 0 0 16px;
  font-size: clamp(2rem, 5.2vw, 3.25rem);
  font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
}

.hero__lead {
  max-width: 640px; margin: 0 0 22px;
  color: var(--muted); font-size: 1.0625rem;
}

.hero__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
}

/* Nút và liên kết ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  line-height: 1.2; transition: background-color .18s ease;
}
.btn:hover { background: var(--accent-strong); }

.link-arrow { color: var(--accent); font-size: 15px; font-weight: 600; }
.link-arrow:hover {
  color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px;
}

/* Khu vực nội dung ---------------------------------------------- */
.section { padding: 44px 0; border-top: 1px solid var(--border); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 4px 18px; margin-bottom: 18px; }
.section__head h2 {
  margin: 0; font-size: clamp(1.5rem, 3vw, 1.875rem);
  line-height: 1.2; letter-spacing: -.01em;
}
.section__en { margin: 0; color: var(--muted); font-size: 13.5px; }
section[id] { scroll-margin-top: 80px; }

/* Thẻ dự án ----------------------------------------------------- */
.cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px;
}

.card {
  display: flex; flex-direction: column; gap: 12px; height: 100%;
  padding: 20px 20px 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.card__head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 8px 10px;
}
.card__name { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.card__desc { flex: 1 1 auto; margin: 0; color: var(--muted); font-size: 15px; }
.card code {
  padding: 1px 4px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); font-family: var(--mono); font-size: .86em;
}

.chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0;
  list-style: none;
}
.chip, .release {
  padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--muted); font-family: var(--mono);
  font-size: 11.5px; line-height: 1.5; white-space: nowrap;
}
.release {
  border-color: #F0C6BE; background: #FBEAE7;
  color: var(--accent); font-weight: 700;
}

.wip {
  align-self: flex-start; margin: -6px 0 0; padding: 3px 10px;
  border: 1px solid #F0C6BE; border-radius: 999px;
  background: #FBEAE7; color: var(--accent); font-size: 12px; font-weight: 600;
}

.btn--card { width: 100%; margin-top: 4px; padding: 11px 16px; font-size: 14px; }
.card__links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 4px; }
.card__links .btn--card { width: auto; flex: 1 1 170px; margin-top: 0; }
.card__gh { font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.card__gh:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Vì sao ViFast ------------------------------------------------- */
.why {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px; margin: 0; padding: 0; list-style: none;
}
.why__item { padding-left: 18px; border-left: 2px solid var(--accent); }
.why__title { margin: 0 0 6px; font-size: 1.0625rem; line-height: 1.4; }
.why__item p { margin: 0; color: var(--muted); font-size: 15px; }
.nowrap { white-space: nowrap; }

/* Cân chiều cao tiêu đề để các đoạn văn thẳng hàng trên desktop */
@media (min-width: 961px) {
  .why__title { min-height: 2.8em; }
}

/* Mã nguồn ------------------------------------------------------ */
.repos {
  margin: 0; padding: 0; list-style: none;
  border-top: 1px solid var(--border);
}
.repo {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 4px 24px;
  padding: 18px 4px; border-bottom: 1px solid var(--border);
  color: var(--text); transition: color .18s ease;
}
.repo:hover { color: var(--accent); }
.repo__name { font-weight: 600; }
.repo__path { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.repo:hover .repo__path { color: var(--accent); }

/* Chân trang ---------------------------------------------------- */
.site-footer { padding: 28px 0; border-top: 1px solid var(--border); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px 24px;
}
.site-footer__copy { margin: 0; color: var(--muted); font-size: 14px; }
.site-footer__links {
  display: flex; flex-wrap: wrap; gap: 18px; margin: 0; padding: 0;
  list-style: none;
}
.site-footer__links a {
  color: var(--muted); font-family: var(--mono); font-size: 13px;
}
.site-footer__links a:hover {
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}

/* Màn hình nhỏ -------------------------------------------------- */
@media (max-width: 960px) {
  .container { width: calc(100% - 40px); }
  .nav-toggle { display: inline-flex; }

  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--border);
  }
  .site-nav.is-open { display: block; }
  .site-nav__list {
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 20px 16px;
  }
  .site-nav__list li + li { border-top: 1px solid var(--border); }
  .site-nav a { display: block; padding: 12px 4px; font-size: 16px; }

  .hero { padding: 32px 0 26px; }
  .section { padding: 32px 0; }
  .cards, .why { grid-template-columns: 1fr; }
  .cards { gap: 16px; }
  .why { gap: 20px; }
}

@media (max-width: 480px) {
  .container { width: calc(100% - 32px); }
  .hero__actions .btn { width: 100%; }
}

/* Tôn trọng lựa chọn giảm chuyển động --------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- logo + ten goi --- */
.brand__logo { display: block; width: 40px; height: 40px; border-radius: 10px;
  box-shadow: 0 8px 18px -8px rgba(179, 20, 15, .55); }
.brand:hover .brand__logo { filter: brightness(1.05); }

.section--name .section__lead { max-width: 62ch; }
.name-grid {
  display: grid; gap: 14px; margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.name-card {
  padding: 22px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--card); color: var(--text);
}
.name-card__title { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.name-card__key { color: var(--accent); }
.name-card p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--muted); }
.name-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "DejaVu Sans Mono", monospace;
  font-size: 13px; padding: 1px 5px; border-radius: 5px;
  background: rgba(192,57,43,.08); color: var(--accent-strong);
}
@media (prefers-reduced-motion: reduce) { .brand__logo { transition: none; } }

/* wordmark: Vi do + Fast nghieng (dong bo voi ViFastKey / ViFastTts) */
.brand-word { font-size: 24px; font-weight: 800; letter-spacing: -1.1px; line-height: 1; }
.brand-word .red { color: var(--accent); }
.brand-word em { font-style: italic; color: var(--text); }
.brand:hover .brand-word .red { color: var(--accent-strong); }

/* Nút GitHub trong header ---------------------------------------- */
.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 600;
  text-decoration: none; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px);
  box-shadow: 0 8px 18px -12px rgba(31, 36, 48, .5); }
.ghost-btn .gh-ico { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }

/* Đầu trang mobile: logo — GitHub — nút menu (đúng thứ tự này) ----------- */
.site-header__inner .site-nav { margin-left: auto; }

@media (max-width: 960px) {
  .site-header__inner { gap: 12px; }
  .site-header__inner .brand { order: 1; margin-right: auto; }
  .site-header__inner .ghost-btn { order: 2; margin-left: 0; padding: 7px 12px; font-size: 13px; }
  .site-header__inner .nav-toggle { order: 3; margin-left: 0; }
}

/* ============================================================
   Bố cục 2026-11 — dày hơn, có hình minh hoạ
   ============================================================ */

/* Hero: giấy kẻ ô mờ + hai cột (chữ | stack ba dự án) */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(234, 219, 204, .5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(234, 219, 204, .5) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(120% 105% at 80% 0%, #000 0%, rgba(0, 0, 0, .45) 46%, transparent 74%);
  mask-image: radial-gradient(120% 105% at 80% 0%, #000 0%, rgba(0, 0, 0, .45) 46%, transparent 74%);
}

.hero__inner {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: 40px; align-items: center;
}

/* Dải số liệu ngay dưới nút */
.facts {
  display: flex; flex-wrap: wrap; gap: 4px 26px;
  max-width: 560px; margin: 22px 0 0; padding: 13px 0 0;
  border-top: 1px solid var(--border); list-style: none;
}
.facts li { display: flex; align-items: baseline; gap: 7px; }
.facts strong {
  color: var(--text); font-size: 1.0625rem; font-weight: 800; letter-spacing: -.01em;
}
.facts span { color: var(--muted); font-size: 12.5px; }

/* Thẻ "một stack nhỏ" */
.stack {
  padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); box-shadow: 0 20px 44px -34px rgba(59, 42, 34, .6);
}
.stack__head {
  display: flex; align-items: center; gap: 7px; margin: 0 0 6px;
  color: var(--muted); font-size: 11.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
}
.stack__dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.stack__list { margin: 0; padding: 0; list-style: none; }
.stack__list li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; column-gap: 10px; row-gap: 1px;
  padding: 9px 2px; border-top: 1px dashed var(--border);
}
.stack__list li:first-child { border-top: 0; }
.stack__list img { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 8px; }
.stack__name { grid-column: 2; grid-row: 1; font-size: 14.5px; font-weight: 700; }
.stack__tag { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12.5px; }
.stack__lang {
  grid-column: 3; grid-row: 1 / span 2; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap;
}
.stack__foot {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding-top: 9px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
}

/* Thẻ dự án: icon + nhãn ngành */
.card__top { display: flex; align-items: center; gap: 10px; }
.card__icon {
  width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
  box-shadow: 0 7px 15px -9px rgba(179, 20, 15, .55);
}
.card__id { min-width: 0; }
.card__name { margin: 0; font-size: 1.0625rem; letter-spacing: -.01em; }
.card__tag { display: block; color: var(--muted); font-size: 12px; }
.card__top .release { margin-left: auto; align-self: flex-start; }
.wip { margin: 0; }

/* Vì sao ViFast: icon thay vì viền trái */
.why__item { padding-left: 0; border-left: 0; }
.why__ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 10px;
  border: 1px solid #F0C6BE; border-radius: 12px; background: #FBEAE7; color: var(--accent);
}
.why__ico svg { width: 21px; height: 21px; }
.why__title { margin: 0 0 5px; font-size: 1rem; }

/* Vì sao tên: huy hiệu chữ */
.name-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.name-card { padding: 16px 18px; }
.name-card__title {
  display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-size: 16px;
}
.name-card__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 26px; padding: 0 8px;
  border-radius: 7px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: -.01em;
}

/* Mã nguồn: ba thẻ ngang thay vì ba dòng */
.repos {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; border-top: 0;
}
.repo {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center; column-gap: 10px; row-gap: 1px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text);
}
.repo:hover { border-color: var(--accent); }
.repo__icon { grid-row: 1 / span 2; width: 28px; height: 28px; border-radius: 7px; }
.repo__name { grid-column: 2; grid-row: 1; font-weight: 700; font-size: 14px; }
.repo__path {
  grid-column: 2; grid-row: 2; color: var(--muted);
  font-family: var(--mono); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.repo__arrow { grid-column: 3; grid-row: 1 / span 2; color: var(--muted); font-size: 14px; }
.repo:hover .repo__arrow { color: var(--accent); }

/* Màn hình nhỏ */
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; gap: 22px; }
  .stack { max-width: 460px; }
  .name-grid, .repos { grid-template-columns: 1fr; }
  .facts { gap: 4px 20px; }
  .why__title { min-height: 0; }
}

@media (max-width: 700px) {
  .br-wide { display: none; }
  .stack { display: none; }
  .facts { margin-top: 18px; }
  .card { padding: 18px 16px 16px; }
}

/* "Vì sao tên" dạng danh sách gọn (bỏ thẻ cao rỗng) */
.why__title { min-height: 0; }
.name-list { border-top: 1px solid var(--border); }
.name-row {
  display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 2px 16px;
  padding: 15px 0; border-bottom: 1px solid var(--border);
}
.name-badge {
  align-self: start; justify-self: start; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 26px; padding: 0 9px;
  border-radius: 7px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: -.01em;
}
.name-row__title { margin: 0 0 3px; font-size: 15.5px; }
.name-row__title em { color: var(--muted); font-size: 14px; }
.name-row__body p { max-width: 96ch; margin: 0; color: var(--muted); font-size: 15px; }
.name-row__body code {
  padding: 1px 5px; border-radius: 5px; background: rgba(192, 57, 43, .08);
  color: var(--accent-strong); font-family: var(--mono); font-size: 13px;
}

@media (max-width: 700px) {
  .name-row { grid-template-columns: 1fr; gap: 6px; }
}

/* Thẻ dự án: chữ co giãn, nút luôn bám đáy (giảm khoảng trống giữa thẻ) */
.card__desc { flex: 0 0 auto; }
.card__links { margin-top: auto; }
.chips { margin-bottom: 0; }

/* Dòng "Vì sao tên" giới hạn bề rộng chữ cho dễ đọc */
.name-row__body p { max-width: 82ch; }
