/* Reset, element defaults and typography rules (DESIGN_CONTRACT.md, sections 3, 5, 9). */

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

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    interpolate-size: allow-keywords;
    scroll-behavior: smooth;
  }

  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 var(--step-0) / 1.6 var(--font-text);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  h1 { font-size: var(--step-3); line-height: 1.1; }
  h2 { font-size: var(--step-2); }
  h3 { font-size: var(--step-1); line-height: 1.25; }

  p, ul, ol, dl { margin: 0; }
  p { max-width: var(--measure); text-wrap: pretty; }

  /* Russian words are long: without hyphenation narrow columns get a ragged edge. */
  p, li, dd, summary {
    -webkit-hyphens: auto;
    hyphens: auto;
  }

  a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--dur-fast) var(--ease-out);
  }
  a:hover { text-decoration-thickness: 2px; }

  img, svg { display: block; max-width: 100%; }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-s);
  }

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

  .skip-link {
    position: absolute;
    left: var(--space-4);
    top: var(--space-4);
    z-index: 10;
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: var(--radius-s);
    transform: translateY(-200%);
  }
  .skip-link:focus-visible { transform: none; }

  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .mono {
    font-family: var(--font-mono);
    font-size: var(--step--1);
  }
}
