/* Plain HTML elements styled only with tokens. Components build on top of this. */
@layer base {
  @font-face {
    font-family: "Ubuntu";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/web/fonts/ubuntu-400.woff2") format("woff2");
  }

  @font-face {
    font-family: "Ubuntu";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/web/fonts/ubuntu-500.woff2") format("woff2");
  }

  @font-face {
    font-family: "Ubuntu";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/web/fonts/ubuntu-700.woff2") format("woff2");
  }

  html {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: "Ubuntu", system-ui, sans-serif;
    font-size: 100%;
    font-weight: var(--weight-regular);
    line-height: var(--leading-normal);
    /* The browser's own surfaces take the palette too: native controls, caret, scrollbars. */
    accent-color: var(--color-action);
    caret-color: var(--color-action);
    scrollbar-color: var(--color-border-strong) transparent;
  }

  h1, h2, h3, h4 {
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    text-wrap: balance;
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  h3 { font-size: var(--text-lg); }
  h4 { font-size: var(--text-base); }

  hr {
    margin: 0;
    border: 0;
    border-block-start: var(--border-width) solid var(--color-border);
  }

  p {
    text-wrap: pretty;
  }

  a {
    color: var(--color-action);
    text-decoration-thickness: var(--border-width);
    text-underline-offset: 0.2em;
  }

  a:hover {
    color: var(--color-action-hover);
  }

  code, kbd, pre, samp {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--text-sm);
  }

  label {
    font-weight: var(--weight-medium);
  }

  /* Form fields need a 3:1 border to be found (WCAG 1.4.11). */
  input:not([type="checkbox"], [type="radio"]),
  select,
  textarea {
    padding: var(--space-2) var(--space-3);
    border: var(--border-width) solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
  }

  button,
  summary,
  select {
    cursor: pointer;
  }

  :disabled {
    cursor: not-allowed;
  }

  /* One focus style for everything; containers on dark backgrounds only swap the outline color. */
  :focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }

  ::selection {
    background: var(--color-action);
    color: var(--color-on-action);
  }

  /* Hidden until focused: the first Tab lands here and jumps to <main id="conteudo">. */
  .skip-link {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: var(--z-toast);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-action);
    color: var(--color-on-action);
    font-weight: var(--weight-medium);
    transform: translateY(-200%);
  }

  .skip-link:focus-visible {
    transform: none;
  }

  /* The single reduced-motion rule (docs/DESIGN.md, Tokens): zero the duration tokens, then catch literals. */
  @media (prefers-reduced-motion: reduce) {
    :root {
      --duration-fast: 0.01ms;
      --duration-base: 0.01ms;
      --duration-slow: 0.01ms;
    }

    *, *::before, *::after {
      animation-duration: 0.01ms;
      animation-iteration-count: 1;
      transition-duration: 0.01ms;
      scroll-behavior: auto;
    }
  }
}
