/* ============================================================
   QASOFT — Base: reset, chữ, nút, nav, footer, chuyển động nền
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* bù chiều cao nav dính khi nhảy anchor */
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-kerning: normal;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  display: block;
}

/* ---- Chữ ---- */
h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-display);
  font-weight: 800;
  line-height: var(--leading-display);
}

h2 {
  font-size: var(--text-headline);
  font-weight: 800;
  line-height: var(--leading-heading);
}

h3 {
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin: 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

.text-soft {
  color: var(--ink-soft);
}

.text-small {
  font-size: var(--text-small);
}

a {
  color: var(--blue);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
}

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

::selection {
  background: var(--mark);
  color: var(--ink);
}

/* ---- Vệt bút dạ quang (Quy tắc Nét Bút) ----
   Highlight bằng background-gradient để ôm được chữ xuống dòng.
   Mặc định hiện đủ; chỉ khi có JS mới thu về 0 chờ "được vẽ vào". */
.mark {
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-size: 100% 0.92em;
  background-position: 0 62%;
  padding: 0 0.1em;
  margin: 0 -0.1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Gạch bút mảnh — cho chữ trắng trên mảng navy */
.mark-under {
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-size: 100% 0.16em;
  background-position: 0 96%;
  padding: 0 0.06em;
  margin: 0 -0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

@media (prefers-reduced-motion: no-preference) {
  .js .mark,
  .js .mark-under {
    background-size: 0% 0.92em;
    transition: background-size var(--dur-ink) var(--ease-out-expo);
  }

  .js .mark-under {
    background-size: 0% 0.16em;
  }

  .js .mark.is-inked {
    background-size: 100% 0.92em;
  }

  .js .mark-under.is-inked {
    background-size: 100% 0.16em;
  }

  /* Khối nội dung hiện dần khi vào khung nhìn */
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition:
      opacity 480ms var(--ease-out-quart),
      transform 560ms var(--ease-out-expo);
    transition-delay: calc(var(--i, 0) * 70ms);
  }

  .js .reveal.is-inked {
    opacity: 1;
    transform: none;
  }
}

/* ---- Bố cục chung ---- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section {
  padding-block: var(--space-3xl);
}

/* ---- Nút ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 1.5em;
  border: 1.5px solid transparent;
  border-radius: 4px;
  font: inherit;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--dur-feedback) var(--ease-out-quart),
    color var(--dur-feedback) var(--ease-out-quart),
    box-shadow var(--dur-state) var(--ease-out-quart),
    transform var(--dur-feedback) var(--ease-out-quart);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--blue);
  color: var(--on-dark);
}

.btn-primary:hover {
  background: var(--navy);
  box-shadow: var(--shadow-hover);
}

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

.btn-ghost:hover {
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

/* Biến thể trên mảng navy */
.btn-on-dark {
  background: var(--white);
  color: var(--navy);
}

.btn-on-dark:hover {
  background: var(--mark);
  box-shadow: 0 6px 24px oklch(0 0 0 / 0.28);
}

.btn-ghost-on-dark {
  border-color: oklch(1 0 0 / 0.65);
  color: var(--on-dark);
  background: transparent;
}

.btn-ghost-on-dark:hover {
  border-color: var(--white);
  background: oklch(1 0 0 / 0.12);
}

.on-dark :focus-visible {
  outline-color: var(--white);
}

/* ---- Nav ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--white);
  border-bottom: 1px solid transparent;
  transition:
    border-color var(--dur-state) var(--ease-out-quart),
    box-shadow var(--dur-state) var(--ease-out-quart);
}

.site-nav.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-nav);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 4.25rem;
}

.brand img {
  width: 122px;
  height: auto;
}

.nav-links {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-small);
  white-space: nowrap;
}

.nav-links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--teal);
  text-decoration-thickness: 2.5px;
  text-underline-offset: 0.35em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-actions .btn {
  padding: 0.55em 1.1em;
  font-size: var(--text-small);
  white-space: nowrap;
}

.lang-switch {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.35em 0.5em;
}

.lang-switch:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--teal);
  text-decoration-thickness: 2.5px;
  text-underline-offset: 0.3em;
}

/* Dưới 62rem (tablet dọc trở xuống): bỏ link anchor vì nav không đủ chỗ
   cho nhãn tiếng Việt dài; giữ logo + EN + Zalo. Không cần menu JS. */
@media (max-width: 61.99rem) {
  .nav-links {
    display: none;
  }
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-2xl) 0; /* mép dưới nhường chỗ cho watermark bị cắt */
}

/* Wordmark khổ lớn, tông rất nhạt, bị cắt ở mép dưới trang.
   height < line-height + overflow hidden = phần chân chữ biến mất. */
.footer-watermark {
  margin-top: var(--space-xl);
  height: 0.58em;
  overflow: hidden;
  font-size: clamp(4.5rem, 16vw, 15rem);
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  color: oklch(0.94 0.018 235);
  user-select: none;
  pointer-events: none;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-xl);
}

.footer-brand img {
  width: 132px;
  height: auto;
  margin-bottom: var(--space-md);
}

.footer-brand p,
.footer-col p {
  font-size: var(--text-small);
  color: var(--ink-soft);
  max-width: 36ch;
}

.footer-col h3 {
  font-size: var(--text-small);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-xs);
}

.footer-col a {
  font-size: var(--text-small);
  color: var(--ink-soft);
}

.footer-col a:hover {
  color: var(--ink);
}

.footer-legal {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
  font-size: var(--text-small);
  color: var(--ink-soft);
}

/* ---- Reduced motion: tắt smooth scroll, mọi thứ hiện ngay ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
