/**
 * base.css — Base layer for cwq_theme.
 *
 * Owns: box model, document defaults, typography, links, media, the
 * Material Symbols icon class, and accessibility defaults (focus, motion).
 * Consumes tokens.css. Loaded AFTER tokens and BEFORE legacy style.css.
 *
 * Layout (header/footer/regions) lives in layout.css (Phase 1).
 * Components (cards/tables/forms/pager) live in components.css (later).
 */

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Headings --------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.2;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-headline-lg);
  font-weight: var(--fw-headline-lg);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--fs-headline-md);
  font-weight: var(--fw-headline-md);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--fs-title);
  font-weight: var(--fw-title);
}

h4 { font-size: var(--fs-body-lg); font-weight: 600; }
h5 { font-size: var(--fs-body);    font-weight: 600; }
h6 { font-size: var(--fs-label);   font-weight: 600; letter-spacing: 0.02em; }

/* ---- Text blocks ------------------------------------------------------ */
p,
ul,
ol,
dl,
blockquote,
table {
  margin: 0 0 1em;
}

p { text-wrap: pretty; }

small { font-size: var(--fs-caption); }

strong, b { font-weight: 600; }

hr {
  border: 0;
  border-top: 1px solid var(--surface-variant);
  margin: 2em 0;
}

blockquote {
  border-left: 3px solid var(--brand);
  padding-left: 1em;
  color: var(--ink-muted);
}

code, pre, kbd, samp {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* ---- Links ------------------------------------------------------------ */
a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

/* ---- Media ------------------------------------------------------------ */
img, svg, video, canvas, embed, object, iframe {
  max-width: 100%;
  height: auto;
}

img, svg, video { display: block; }

/* ---- Material Symbols (icon font) ------------------------------------- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ---- Accessibility: focus + reduced motion ---------------------------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r);
}

::selection {
  background: var(--brand-tint);
  color: var(--ink);
}

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