@layer reset, base, layout, components;

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

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  dl,
  dd,
  ol,
  ul {
    margin: 0;
  }

  ol,
  ul {
    padding: 0;
  }

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

  img {
    height: auto;
  }

  button,
  input {
    font: inherit;
    color: inherit;
  }

  table {
    border-collapse: collapse;
  }
}

@layer base {
  html {
    text-size-adjust: 100%;
    scroll-padding-top: var(--space-lg);
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  body {
    min-height: 100vh;
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-text);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    font-kerning: normal;
    text-rendering: optimizelegibility;
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-xl);
  }

  h3 {
    font-size: var(--text-lg);
  }

  p {
    text-wrap: pretty;
  }

  a {
    color: var(--color-plum);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color var(--duration) var(--ease);
  }

  a:hover {
    color: var(--color-plum-deep);
    text-decoration-thickness: 2px;
  }

  :focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
  }

  strong {
    font-weight: 650;
  }

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

@layer layout {
  .page {
    width: min(100% - 2 * var(--gutter), var(--width-page));
    margin-inline: auto;
  }

  .page--text {
    width: min(100% - 2 * var(--gutter), var(--width-text));
  }

  .page--wide {
    width: min(100% - 2 * var(--gutter), var(--width-wide));
  }

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