/* Base: reset, type, focus and motion preferences. */

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

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    margin: 0;
    min-height: 100dvh;
    background: var(--color-page);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* An element with an event style paints its own page colour, so a
     style section inside a Live page reads as that event's page. */
  [data-style] {
    background: var(--color-page);
    color: var(--color-text);
    font-family: var(--font-body);
  }

  h1,
  h2,
  h3,
  h4 {
    margin: 0;
    color: var(--color-heading);
    text-wrap: balance;
  }

  p {
    margin: 0;
    text-wrap: pretty;
  }

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

  svg {
    flex-shrink: 0;
  }

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

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

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

  ::selection {
    background: var(--color-brand-soft);
    color: var(--color-heading);
  }

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

  [hidden] {
    display: none !important;
  }

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