/* small helper classes used here and there, instead of inline styles.
   loaded last so these can override spacing set by other css files */

/* margin-top helpers, smallest to largest gap */
.mt-sm  { margin-top: .5rem; }
.mt-md  { margin-top: 1rem; }
.mt-lg  { margin-top: 1.5rem; }
.mt-xl  { margin-top: 2rem; }
.mt-xxl { margin-top: 2.5rem; }

/* Margin-bottom helpers. */
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }

/* Small grey text, e.g. a date or email next to someone's name. */
.text-muted-sm {
  color: var(--color-text-muted);
  font-size: .8rem;
}

/* centers text, for stuff not already wrapped in .section-title */
.text-center {
  text-align: center;
}

/* hides visually but keeps it readable for screen readers -- e.g. a
   table caption, sighted users don't need it since the heading already
   says what the table is */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* lets one element size itself instead of stretching full width (inputs
   and buttons default to 100%) -- e.g. a checkbox next to its label */
.w-auto {
  width: auto;
}

/* visually hides an element -- used for radio buttons where we show a
   styled card instead but keep the real input for accessibility */
.radio-hidden {
  display: none;
}

/* toast - small pop-up message, see assets/js/cart.js */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--color-primary-dark);
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 9999;
  font-family: inherit;
  opacity: 0;
  transition: opacity .25s ease;
}

/* cart.js adds this a moment after the toast shows up, fades it in
   (see transition above) */
.toast-visible {
  opacity: 1;
}

/* loading spinner next to a control while its ajax request is running
   (e.g. cart page qty stepper). toggled with the hidden attribute, not
   a class, so no extra js needed */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    opacity: .6;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
