@layer reset, tokens, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
  ul { padding: 0; list-style: none; }
  img, svg { display: block; max-inline-size: 100%; block-size: auto; }
  button, input, select, textarea { font: inherit; color: inherit; }
}

@layer base {
  html { -webkit-text-size-adjust: 100%; }

  body {
    min-block-size: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--text-md);
    font-weight: var(--weight);
    line-height: var(--leading);
    overflow-wrap: anywhere;
  }

  a { color: var(--accent); }

  :focus-visible { outline: var(--focus); outline-offset: 2px; }

  main:focus { outline: none; }

  /* Read by a screen reader and takes no space on screen. */
  .sr-only {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* The first stop for the Tab key, shown only while it has focus. */
  .skip-link {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--bg);
    color: var(--ink);
  }

  .skip-link:not(:focus) {
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  code { font-size: var(--text-sm); }

  /* A page on its way, shown only after a pause so a fast page never flashes it. Set by quanto.js. */
  .is-navigating body::before {
    content: "";
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: 200;
    block-size: 3px;
    background: var(--accent);
    transform-origin: left;
    animation: page-coming 1.6s var(--ease) infinite alternate;
  }
  @keyframes page-coming { from { transform: scaleX(0.15); } to { transform: scaleX(0.85); } }
  @media (prefers-reduced-motion: reduce) { .is-navigating body::before { animation: none; } }
}
