/**
 * Thơm — Base
 * Reset and element-level defaults. No component styling here.
 * Every value comes from tokens.css.
 */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  letter-spacing: var(--ls-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-4);
  font-family: var(--font-display);
  font-variation-settings: var(--font-display-variation);
  font-weight: var(--fw-black);   /* Fraunces Black — Figma H1–H3 */
  color: var(--c-text);
  text-wrap: balance;
}

/* Each level carries its own line-height and tracking, exactly as the
 * Figma text styles define them — they are not a single shared value. */
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--ls-h3); }

/* Figma steps H4 and H5 drop to Fraunces Bold. */
h4 {
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: var(--lh-h4);
  letter-spacing: var(--ls-h4);
}
h5 {
  font-size: var(--fs-h5);
  font-weight: var(--fw-bold);
  line-height: var(--lh-h5);
  letter-spacing: var(--ls-h5);
}
h6 {
  font-size: var(--fs-label);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--c-action);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--c-action-hover); }

:focus-visible {
  outline: var(--border-width-thick) solid var(--c-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

ul, ol { margin: 0 0 var(--sp-4); padding-inline-start: var(--sp-6); }
li { margin-bottom: var(--sp-2); }

blockquote {
  margin: var(--sp-8) 0;
  padding-inline-start: var(--sp-6);
  border-inline-start: var(--border-width-thick) solid var(--c-action-subtle);
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--c-text-muted);
}

hr {
  margin: var(--sp-12) 0;
  border: 0;
  border-top: var(--border-width) solid var(--c-border);
}

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: var(--sp-3) var(--sp-4);
  text-align: start;
  border-bottom: var(--border-width) solid var(--c-border);
}
th { font-weight: var(--fw-semibold); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }

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

/* Accessibility helpers */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-6);
  background: var(--c-surface);
  color: var(--c-text);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
  transition: transform var(--dur-base) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }
