/* DeployBot UI, base layer: element defaults, the reduced-motion switch and the global
   keyframes. The layer order, fonts and tokens are in tokens.css. */

@layer base {
  /* a fieldset is only a way to disable a whole form at once: no box of its own */
  fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
  }

  /* ---- elements */

  html {
    scroll-padding-top: var(--sticky-offset);
  }

  html,
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--font-sans);
    -webkit-font-smoothing: antialiased;
  }

  a {
    color: var(--accent-text);
    text-decoration: none;

    &:hover {
      color: var(--text);
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  input,
  select,
  textarea,
  button {
    font-family: inherit;
  }

  :is(input, select, button, textarea, a, summary):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
  }

  input::placeholder {
    color: var(--muted);
    opacity: .7;
  }

  /* ---- reduced motion */

  /* the one legitimate !important: important declarations in an earlier layer beat those in
     later layers and every normal one, so this switches off all animations and transitions */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation: none !important;
      transition: none !important;
    }
  }

  /* ---- base */

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  body {
    position: relative;
    min-height: 100vh;
  }

  h1,
  h2,
  h3,
  h4,
  p,
  ul,
  ol,
  dl,
  dd,
  figure,
  pre {
    margin: 0;
  }

  p + p {
    margin-top: var(--space-3);
  }

  h1 {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.025em;
    line-height: 1.2;
  }

  h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.015em;
  }

  /* .mono stays in base, not utilities: input.mono, .kv .mono, .tbl-row .mono and .banner.mono
     set their own size over it */
  code,
  .mono {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    font-size: var(--text-3);
  }

  code {
    font-size: .92em;
  }

  /* .micro stays in base, not utilities: .tbl-row .mono (12px) overrides it on the import rows */
  .micro {
    font-size: var(--text-2);
  }

  ul.plain {
    list-style: none;
    padding: 0;
  }

  summary {
    cursor: pointer;
  }
}

/* keyframes are global, outside the layers */
@keyframes db-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .35;
    transform: scale(.7);
  }
}

@keyframes db-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes db-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}
