/* Base — mobile-first, semantic HTML, WCAG AA, reduced-motion */
@import "./tokens.css";

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

/* BẮT BUỘC: thuộc tính hidden phải luôn ẩn phần tử.
   Lỗi đã gặp 17/11/2026: .modal-overlay { display: flex } và
   .search-overlay / .mega (display: grid) đè quy tắc mặc định của
   trình duyệt cho [hidden], nên JS đặt hidden = true mà popup vẫn
   hiện — bấm nút ✕ / Huỷ / Esc / bấm ra ngoài đều không đóng được.
   Quy tắc này phải có !important để thắng mọi display trong component. */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-body);
  line-height: var(--line-height-normal);
  color: var(--color-on-surface);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-headline); }
h3 { font-size: var(--text-title); }

p { margin: 0; }

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Focus visible rõ — không bỏ outline mà không thay thế */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

button {
  font: inherit;
  cursor: pointer;
}

/* Container chung — mọi section dùng cùng một container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-mobile);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--container-padding-tablet); }
}

.section {
  padding-block: var(--space-12);
}
@media (min-width: 1024px) {
  .section { padding-block: var(--space-16); }
}

/* Đoạn văn chính không quá 75 ký tự / dòng */
.prose {
  max-width: 68ch;
  line-height: var(--line-height-relaxed);
  color: var(--color-on-surface-variant);
}

/* Tôn trọng prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
