@layer reset {
  /*
  * Modern CSS Reset
  * @link https://github.com/hankchizljaw/modern-css-reset
  */

  /* Box sizing rules */
  *, *::before, *::after { box-sizing: border-box; }

  /* Remove default margin */
  body, h1, h2, h3, h4, h5, h6 { margin: 0; }

  p, li, h1, h2, h3, h4 {
    /* Help prevent overflow of long words/names/URLs */
    word-break: break-word;
    /* Not supported for all languages */
    hyphens: auto;
  }

  html, body { overflow-x: clip; }

  /* Set core body defaults */
  body {
    min-height: 100dvh;
    font-family: sans-serif;
    font-size: 100%;
    line-height: 1.5;
    text-rendering: optimizeSpeed;
  }

  /* Make images easier to work with */
  img {
    display: block;
    max-inline-size: 100%;
  }

  /* Inherit fonts for inputs and buttons */
  input, button, textarea, select { font: inherit; }

  button { cursor: pointer; }

  /* Hide the default arrow of summary/details blocks */
  summary {
    &::-webkit-details-marker { display: none; }
    &::marker { content: ""; }
  }

  /* Remove all animations and transitions for people that prefer not to see them */
  @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;
    }
    html { scroll-behavior: initial; }
  }

  dialog {
    border: 0;
    padding: 0;

    &:where(:focus-visible):focus,
    &:where(:focus-visible):active {
      outline: 0;
    }
  }
}

@layer base {
  body {
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: none;
    background: var(--color-canvas);
    color: var(--color-ink);
    font-family: var(--font-sans);
    interpolate-size: allow-keywords;
    line-height: 1.375;
    max-inline-size: 100vw;
    scroll-behavior: auto;
    text-rendering: optimizeLegibility;
    text-size-adjust: none;
  }

  a {
    text-decoration: none;

    &:not([class]) {
      color: var(--color-blue-medium);
      text-decoration: underline;
      text-decoration-skip-ink: auto;
      text-underline-offset: 2px;

      &:hover {
        color: var(--color-blue-dark);
        text-decoration: none;
      }
    }
  }

  :is(a, button, input, textarea, select .btn) {
    transition: 100ms ease-out;
    transition-property: background-color, border-color, box-shadow, outline;
    touch-action: manipulation;

    /* Keyboard navigation */
    &:where(:focus-visible) {
      border-radius: var(--border-radius);
      outline: var(--focus-ring-size) solid var(--focus-ring-color);
      outline-offset: var(--focus-ring-offset);
    }

    /* Default disabled styles */
    &:where([disabled]) {
      cursor: not-allowed;
      opacity: 0.5;
      pointer-events: none;
    }
  }

  ::selection {
    background: oklch(var(--lch-blue-light));
  }

  :where(ul, ol):where([role="list"]) {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  kbd {
    border: 1px solid;
    border-radius: 0.3em;
    box-shadow: 0 0.1em 0 currentColor;
    font-family: var(--font-mono);
    font-size: 0.8em;
    font-weight: 600;
    opacity: 0.7;
    padding: 0 0.4em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
  }

  video {
    max-inline-size: 100%;
  }

  dl {
    display: grid;
    grid-template-columns: 1fr 3fr;
    grid-template-rows: auto;
  }
  dt {
    grid-column-start: 1;
  }
  dd {
    grid-column-start: 2;
  }

  /* Printing */
  @page {
    margin: 1in;
  }

  @media print {
    .no-print {
      display: none;
    }
  }

  /* Turbo */
  turbo-frame,
  turbo-stream-channel {
    display: contents;
  }

  .turbo-progress-bar {
    visibility: hidden;
  }

  .hidden {
    display: none !important;
  }

  .container {
    margin-left: auto;
    margin-right: auto;
    max-width: 90ch;
    padding: 1rem;
  }

  .alerts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
    padding: 1rem 0;

    .alert {
      display: flex;
      gap: 0.5rem;
      padding: 1rem 0;
    }
    .alert--positive,
    .alert--info {
      color: var(--color-positive);
    }
    .alert--negative,
    .alert--error {
      color: var(--color-negative);
    }
  }
}
