/* Page-level baseline — background/text color and a box-sizing reset.
   Was in the marketing-page base.css deleted early in this rebuild; that
   file also carried a duplicate @font-face and stale token names, so it
   wasn't reusable. This is the minimal, token-correct replacement. */

@layer base {
  /* Line wrapping (kit rule, 2026-10-03): text that runs to two or more lines
     never leaves one word alone on its last line ("pretty"); headings even out
     their lines ("balance"). Components can override; the inspector's Wrap field too. */
  p, li, dd, dt, figcaption, blockquote, label, td { text-wrap: pretty; }
  h1, h2, h3, h4 { text-wrap: balance; }
  /* Read by screen readers, not shown. */
  .sr-only { font: var(--body-s); position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

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


  /* Reduced motion safety net (WCAG 2.3.3): transitions and animations finish
     at once. .01ms, not 0, so transitionend / animationend still fire. */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      transition-delay: 0s !important;
      scroll-behavior: auto !important;
    }
  }

  /* Numbers are always tabular lining figures: every digit one width (so
     columns compare), and the tabular 1 has its base stem. !important is
     what makes it stick — every type token is applied with the `font`
     shorthand, which resets font-variant-numeric to normal, so a plain
     inherited value would be wiped on nearly every element. An !important
     declaration in any layer beats all normal declarations. */
  *, *::before, *::after {
    font-variant-numeric: tabular-nums lining-nums !important;
  }

  /* The native CSS `corner-shape`/superellipse() property (Borders Level 4
     draft) was tried here as a global reset and tested across every radius
     the kit uses on /kit/corners — retired. At the radii most components
     actually use (2-24px) any curve difference was imperceptible, and
     pushing it further didn't read as smoother, just flatter/more
     geometric. CornerKit (see src/components/ui/squircle.tsx) replaced it
     for the specific places that still want a squircle curve; plain
     border-radius (browsers' actual default rendering) is used everywhere
     else, which is exactly what this reset used to produce anyway. */

  html {
    margin: 0;
    background-color: var(--n10);
    color: var(--n150);
    font: var(--body-m);
    letter-spacing: var(--body-m-ls);
    -webkit-font-smoothing: antialiased; /* macOS only; Firefox 128+ reads it too, so no -moz- twin (dbushell.com, 2024) */
  }

  body {
    margin: 0;
    min-height: 100vh;
  }
}

/* No iOS zoom into fields (2026-11-14). iPhone Safari zooms in when a field
   with text under 16px gets focus. Pinch zoom stays on (WCAG 1.4.4), so
   instead fields get 16px text on iPhones and iPads only. That's the one
   size outside the type tokens, and it only applies there. Unlayered, so it
   wins over the component layers. */
@supports (-webkit-touch-callout: none) {
  @media (pointer: coarse) {
    input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select { font-size: max(1em, 16px); }
  }
}

/* Tap areas (WCAG 2.5.8, 2026-11-14). Small buttons keep their look, but an
   invisible box at least 24 × 24 sits around each one, so a finger or a shaky
   hand still hits it. Bigger buttons are untouched (max with 100%). */
@layer components {
  :is(.info-tip, .tag-remove, .field-clear, .breadcrumb-more, .class-code, .ui-slider-thumb, .rz:not(.is-sheet) > .rz-grip) { position: relative; }
  :is(.info-tip, .tag-remove, .field-clear, .toast-close, .breadcrumb-more, .class-code, .ui-slider-thumb, .rz:not(.is-sheet) > .rz-grip)::before {
    content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%;
    width: max(100%, 24px); height: max(100%, 24px);
  }
}
