/* ============================================================
   Sinh Vũ — Base layer
   Element resets, document defaults, and the subtle paper-grain
   surface treatment. Tokens are defined in the other files;
   this applies sensible defaults so specimens look right.
   ============================================================ */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  color: var(--text-primary);
  background: var(--surface-page);
  font-feature-settings: 'cv05' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-snug);
  color: var(--text-primary);
  margin: 0 0 0.5em;
  text-wrap: balance;
}

p { margin: 0 0 1em; text-wrap: pretty; }

a { color: var(--text-accent); text-decoration: none; transition: color var(--dur-base) var(--ease-out); }
a:hover { color: var(--accent-hover); }

/* Genuine inline text links opt into a refined underline that grows on hover.
   Structural anchors (cards, nav, tiles) stay clean — no blanket underline. */
.sv-link {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background-size var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.sv-link:hover { background-size: 100% 1px; }
@media (prefers-reduced-motion: reduce) { .sv-link { transition: none; } }

::selection { background: var(--color-warm-cream); color: var(--color-bordeaux); }

:focus-visible {
  outline: 2px solid transparent; /* visible in forced-colors / high-contrast mode */
  outline-offset: 2px;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* Screen-reader-only utility (labels for icon-only controls). */
.sv-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;
}

/* Honour OS high-contrast: draw a real outline the box-shadow can't show. */
@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
}

/* ---- Subtle paper grain ----
   Apply .paper-grain to a surface for a tactile, premium feel.
   Layers a faint fractal-noise texture over the element's bg. */
:root {
  --grain-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E"); /* @kind other */
}

.paper-grain { position: relative; isolation: isolate; }
.paper-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain-url);
  background-size: 180px 180px;
  mix-blend-mode: multiply;
  opacity: 0.04;
  pointer-events: none;
  z-index: -1;
}
[data-theme="dark"] .paper-grain::after {
  mix-blend-mode: overlay;
  opacity: 0.05;
}

/* Eyebrow / overline helper used widely across the brand */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-accent);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
