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

  html {
    -webkit-text-size-adjust: 100%;
    color-scheme: light dark;
    background: var(--canvas);
  }

  html[data-theme="light"] {
    color-scheme: light;
  }

  html[data-theme="dark"] {
    color-scheme: dark;
  }

  body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
    margin: 0;
  }

  h1, h2, h3, h4 {
    font-weight: 620;
    line-height: 1.15;
    letter-spacing: -0.018em;
  }

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

  ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 0.2em;
  }

  a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
  }

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

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

  button {
    cursor: pointer;
  }

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

  table {
    border-collapse: collapse;
    width: 100%;
  }

  hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
  }

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

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

  ::placeholder {
    color: var(--muted);
    opacity: 1;
  }

  details summary {
    cursor: pointer;
  }

  details summary::-webkit-details-marker {
    display: none;
  }

  [hidden] {
    display: none !important;
  }

  .linkified {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
  }

  .linkified:hover {
    color: var(--accent-hover);
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}
