/* Reset, page background and the primitives every section reuses.
   Nothing here knows about a specific section; that lives in components.css. */

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

  html {
    scroll-padding-top: var(--topbar-offset);
  }

  body {
    background-color: var(--paper);
    background-image:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 64px 64px;
    background-position: -1px -1px;
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
  }

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

  a {
    color: inherit;
    text-decoration: none;
  }

  :focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
  }

  /* Headings carry structure only; how they look comes from their class. */
  h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
  }

  ul, ol {
    list-style: none;
  }

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

  pre {
    font: inherit;
  }

  /* ---------- primitives ---------- */

  .wrap {
    max-width: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .section {
    position: relative;
    padding-block: var(--section-pad);
  }
  .section--flush {
    padding-block: 0;
  }
  .section--alt {
    background: var(--paper-2);
    border-block: 1px solid var(--ink);
  }

  /* The small mono caption used for eyebrows, numbers, meta rows and footers.
     Components adjust size or tracking on top of it. */
  .label {
    font-family: var(--mono);
    font-size: var(--fs-mono-sm);
    text-transform: uppercase;
    letter-spacing: var(--track-lg);
    color: var(--muted);
  }

  /* The serif display face. <em> inside it turns into the light italic. */
  .display {
    font-family: var(--serif);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1;
  }
  .display em {
    font-style: italic;
    font-weight: 300;
  }
}

@layer utilities {
  /* Added by site.js only when motion is allowed, so without JavaScript
     nothing starts hidden. It is an animation rather than a transition so it
     does not replace the element's own transitions (the card hover). */
  .reveal:not(.is-visible) {
    opacity: 0;
    translate: 0 24px;
  }
  .reveal.is-visible {
    animation: reveal 0.8s ease both;
  }

  @keyframes reveal {
    from {
      opacity: 0;
      translate: 0 24px;
    }
  }

  /* Every animation runs once, instantly, and lands on its final frame.
     Being in the last layer, this beats the components without !important. */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms;
      animation-iteration-count: 1;
      transition-duration: 0.01ms;
    }
  }
}
