/*
 * base.css — @font-face, reset, base typography, :lang() rules, focus styles.
 */

/* ---- Fonts ------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-var.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Noto Sans Thai';
  src: url('../fonts/noto-sans-thai-var.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0E00-0E7F, U+25CC;
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
/* The hidden attribute must always win — otherwise `svg { display:block }` above
   forces the hidden inline icon sprite visible, adding ~150px above the header. */
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base-size);
  line-height: var(--text-base-line);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--neutral-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Headings ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-size: var(--text-3xl-size); line-height: var(--text-3xl-line); font-weight: 700; }
h2 { font-size: var(--text-2xl-size); line-height: var(--text-2xl-line); }
h3 { font-size: var(--text-xl-size); line-height: var(--text-xl-line); }

/* ---- Thai typography rules (mandatory) ----------------------------------- */
:lang(th) { letter-spacing: 0; } /* never track Thai glyphs */
:lang(th) body, :lang(th) p { line-break: strict; }
th, .table-label { text-transform: none; } /* Thai has no case — never uppercase */
.tabular { font-variant-numeric: tabular-nums; }

/* ---- Links --------------------------------------------------------------- */
a.link, .prose a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.link:hover, .prose a:hover { color: var(--blue-700); }

/* ---- Selection ------------------------------------------------------------ */
::selection { background: var(--blue-100); color: var(--blue-900); }

/* ---- Focus ----------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* ---- Skip link -------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  z-index: 200;
  background: var(--neutral-900);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm-size);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-4);
}

/* ---- Icons -------------------------------------------------------------------- */
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---- Reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .tool-card:hover { transform: none; }
  .skeleton { animation: none; background: var(--neutral-100); }
}
