/* Lock the cascade-layer order so specificity behaves the same as it did
   under Tailwind (reset/base elements lose to unlayered component/feature
   rules, which lose to nothing). Unlayered rules still win over all layers. */
@layer base, components, utilities;

/* ============================================================
   Modern CSS reset — replaces Tailwind Preflight (removed in the
   teardown). Values mirror Tailwind v4 Preflight so the layouts,
   which assume border-box sizing, zeroed margins, reset headings/
   lists and inherited form fonts, keep rendering identically.
   ============================================================ */
@layer base {
  *,
  ::before,
  ::after,
  ::backdrop {
    box-sizing: border-box;
    border: 0 solid;
    margin: 0;
    padding: 0;
  }

  html,
  :host {
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
    line-height: 1.5;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
  }

  body {
    line-height: inherit;
  }

  hr {
    height: 0;
    color: inherit;
    border-top-width: 1px;
  }

  /* Headings inherit size/weight; component classes set their own scale. */
  h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
  }

  a {
    color: inherit;
    text-decoration: inherit;
  }

  b, strong {
    font-weight: bolder;
  }

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

  small {
    font-size: 80%;
  }

  sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
  }
  sub { bottom: -0.25em; }
  sup { top: -0.5em; }

  table {
    text-indent: 0;
    border-color: inherit;
    border-collapse: collapse;
  }

  /* Form controls inherit the surrounding font/colour. */
  button, input, select, optgroup, textarea {
    font: inherit;
    font-feature-settings: inherit;
    font-variation-settings: inherit;
    letter-spacing: inherit;
    color: inherit;
    background-color: transparent;
    border-radius: 0;
  }

  button,
  input:where([type="button"], [type="reset"], [type="submit"]) {
    appearance: button;
  }

  button,
  [role="button"] {
    cursor: pointer;
  }

  :disabled {
    cursor: default;
  }

  img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    vertical-align: middle;
  }

  img, video {
    max-width: 100%;
    height: auto;
  }

  ol, ul, menu {
    list-style: none;
  }

  textarea {
    resize: vertical;
  }

  ::placeholder {
    opacity: 1;
    color: color-mix(in srgb, currentColor 50%, transparent);
  }

  :where([hidden]:not([hidden="until-found"])) {
    display: none !important;
  }

  /* ---------- Base element styles (ported from the old Tailwind entry,
     now token-driven). Bare elements without a component class fall back
     to these. ---------- */
  h1 {
    margin-block: var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--txt-3xl);
    line-height: var(--leading-3xl);
    font-weight: var(--weight-bold);
    color: var(--txt);
  }

  select {
    border: 1px solid var(--border);
    padding: var(--space-2);
    background: var(--surface);
    color: var(--txt);
    font-size: var(--txt-sm);
  }

  kbd {
    border: 1px solid;
    border-radius: 0.3em;
    box-shadow: 0 0.1em 0 currentColor;
    font-family: var(--font-mono);
    font-size: 0.8em !important;
    font-weight: 600;
    opacity: 0.7;
    padding: 0 0.4em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
  }
}
