/**
 * Modern CSS Reset
 * Based on Josh Comeau's reset with adaptations for GuessWatts
 * 
 * Goals:
 * - Remove default margins
 * - Sensible box-sizing
 * - Better text defaults
 * - Remove list styles on lists with roles
 * - Accessible focus states
 */

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

  /* Remove default margins */
  * {
    margin: 0;
  }

  /* Body defaults */
  body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  /* Media defaults */
  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

  /* Remove built-in form typography styles */
  input,
  button,
  textarea,
  select {
    font: inherit;
  }

  /* Avoid text overflows */
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  /* Remove list styles on ul, ol with role */
  ul[role='list'],
  ol[role='list'] {
    list-style: none;
    padding: 0;
  }

  /* Anchor defaults */
  a {
    color: inherit;
    text-decoration-skip-ink: auto;
  }

  /* Button reset: the base layer, so any component rule wins without knowing it */
  button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
  }

  /* The one reduced-motion rule for the site: everything that moves becomes instant. 0s, not the
     usual 0.01ms: no script waits on transition events, and a view being shown has to be visible in
     the same frame so focus() reaches it (components-input-views.css). */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0s !important;
      animation-delay: 0s !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0s !important;
      transition-delay: 0s !important;
      scroll-behavior: auto !important;
    }
  }

  /* The hidden attribute always wins over a component's display value */
  [hidden] {
    display: none !important;
  }

  /* Improve focus visibility */
  :focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus-ring);
    outline-offset: var(--focus-ring-offset);
  }

  /* Remove focus outline for mouse users */
  :focus:not(:focus-visible) {
    outline: none;
  }

  /* Table defaults */
  table {
    border-collapse: collapse;
  }

  /* Form elements */
  fieldset {
    border: none;
    padding: 0;
  }

  legend {
    padding: 0;
  }

  /* Dialog reset */
  dialog {
    padding: 0;
    border: none;
    background: transparent;
  }

  dialog::backdrop {
    background: var(--color-backdrop);
  }

  /* Remove native number input arrows */
  input[type="number"] {
    -moz-appearance: textfield;
  }

  input[type="number"]::-webkit-outer-spin-button,
  input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}
