@layer base, rmx, app;

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

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

  body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--size-md);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3,
  h4,
  p {
    margin: 0;
  }

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

  a {
    color: inherit;
  }

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

  code,
  kbd {
    font-family: var(--font-mono);
  }
}

@layer app {
  .error-page {
    display: grid;
    gap: var(--space-3);
    max-width: 62ch;
    margin: 0 auto;
    padding: 20vh var(--space-4) var(--space-4);
  }

  .error-page h1 {
    font-size: var(--size-display);
    font-weight: 300;
    letter-spacing: -0.03em;
  }

  .error-page a {
    color: var(--color-text);
  }

  @media (pointer: coarse) {
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]),
    select,
    textarea {
      font-size: max(16px, 1em);
    }
  }
}

@layer app {
  html[data-navigating]::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    height: 2px;
    background: var(--color-text);
    transform-origin: left;
    pointer-events: none;
    animation: navigation-progress 8s cubic-bezier(0.1, 0.7, 0.2, 1) 150ms both;
  }

  html[data-navigating] [data-content-scroll] {
    opacity: 0.6;
    transition: opacity 0.2s 0.3s;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-navigating]::before {
    animation: none;
    transform: scaleX(0.6);
  }
}

@keyframes navigation-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(0.9);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes loading-sweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes loading-bar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@keyframes pitch-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}
