/*
 * Base — document-level defaults.
 *
 * Typeface (Inter), body color, line-height. Add to this file only when
 * a default is genuinely wrong everywhere in the app, not in a single
 * place. Single-place overrides belong in the component's own file.
 */

@layer base {
  /* Border-box everywhere so padding and border count INSIDE an
     element's declared size rather than expanding it. The default
     content-box behavior breaks any layout that uses min-height: 100vh
     plus padding (the padding silently adds another 2*padding to the
     element height, pushing it past the viewport). Standard reset. */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 system-ui, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "cv11", "ss01", "ss03";
    color: var(--color-text-body);
    background: var(--color-white);
    line-height: 1.5;
  }

  /* The app-wide type size (slice 101c, CEO): body and muted text read at the chart
     of accounts' size, --text-xs. Set on BODY, never on html — every token and every
     spacing value is in rem, which is relative to the root, so a 12px html would
     shrink the whole scale by a quarter (--text-xs itself would become 9px). Pinned
     by a browser test: html stays at the browser default, body computes to 12px. */
  body { margin: 0; font-size: var(--text-xs); }

  /* Form controls do not inherit font by default (a bare <button> renders at the
     browser's 13.33px); make them read like the text around them. `font` is the
     shorthand: this resets FAMILY (UA default → Inter), SIZE (→ 12px), WEIGHT and
     LINE-HEIGHT (UA "normal" ≈ 1.2 → the inherited 1.5), so a control with no class at
     all — today, the journal-entry editor's row inputs, its Remove button and its
     date/type selects — renders in Inter at 12px and stands a little taller than the
     browser drew it. Component classes (.btn, .form-field__input) still set their own
     size and line-height on top and are unaffected. Browser-pinned on the JE editor. */
  button, input, select, textarea { font: inherit; }

  /* Headings — a restrained scale so raw content reads as designed
     even before a page adopts component classes. Page titles use
     `.page-header__title`; these cover in-content headings, and land
     on the four roles named in _global.css's typography block. */
  h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-heading);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin: 0 0 var(--space-3);
  }

  h1 { font-size: var(--text-xl); letter-spacing: -0.015em; }   /* page title */
  h2 { font-size: var(--text-base); letter-spacing: -0.01em; }  /* section heading */
  h3 { font-size: var(--text-sm); }                             /* a heading: stays (CEO 101c) */
  h4, h5, h6 { font-size: var(--text-xs); }                     /* muted heading */

  p { margin: 0 0 var(--space-4); }

  ul, ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
  li { margin: 0 0 var(--space-1); }

  strong, b { font-weight: 600; color: var(--color-text-heading); }

  hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: var(--space-6) 0;
  }

  small { font-size: var(--text-xs); }

  a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 120ms ease;
  }

  a:hover {
    color: var(--color-link-hover);
  }

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