/* Reset + typography. Không đụng tới component. */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);   /* canvas không trắng khi body chưa cao đủ màn hình lúc load */
  transition: background var(--t-base);
}

/* Nền pastel mesh. Glass cần chi tiết tần số cao để backdrop-filter đọc ra kính. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

body::before {
  width: 58vw; height: 58vw;
  left: -16vw; top: -20vw;
  background: radial-gradient(circle at 42% 42%, var(--mesh-1), transparent 68%);
}

body::after {
  width: 52vw; height: 52vw;
  right: -14vw; bottom: -22vw;
  background: radial-gradient(circle at 55% 45%, var(--mesh-2), transparent 68%);
}

/* Lưới mảnh + vệt thứ ba: tăng chi tiết để kính "bắt" được nền */
.mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 72% 6%, var(--mesh-3), transparent 42%),
    linear-gradient(to right, var(--mesh-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--mesh-line) 1px, transparent 1px);
  background-size: 100% 100%, 52px 52px, 52px 52px;
}

body {
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: color var(--t-base);
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: none; padding: 0; }

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

/* Kính dùng chung: 2 lớp — scrim + sheen sáng mỏng */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

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

::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbar — mảnh, không phô */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}

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

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
