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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 var(--fs-body) / 1.625 var(--font-sans);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; }

h1, h2, h3 { margin: 0; font-family: var(--font-sans); color: var(--color-text-primary); text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 800; line-height: 1.02; letter-spacing: -0.04em; max-width: 14ch; }
h2 { font-size: var(--fs-h2); font-weight: 800; line-height: 1.06; letter-spacing: -0.035em; }
h3 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }

/* Nhấn mạnh bằng Newsreader italic */
.accent { font-family: var(--font-serif); font-style: italic; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }

a { color: var(--color-primary-fg); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--color-primary-fg-hover); text-decoration-thickness: 2px; }

::selection { background: var(--color-accent); color: var(--color-on-accent); }

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

/* Focus luôn rõ, không bị bóng đổ che (B1) */
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

.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: -100px; z-index: 100;
  padding: 10px 18px; border-radius: 9999px;
  background: var(--color-primary); color: var(--color-on-primary); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--color-text-muted); }
.mono { font-family: var(--font-mono); font-size: 0.94em; }

/* Mọi chuyển động phải tôn trọng người dùng giảm chuyển động (A5) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
