/**
 * VISIBLEMILES — Modern CSS Reset
 * Provides a consistent baseline across browsers
 */

/* Box sizing for all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* Prevent font size inflation on mobile.
   Intentional for this fullscreen game UI — all text is sized relative to
   the viewport and scaling would break the pixel-art aesthetic and HUD layout.
   Content sites should NOT use this. */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Remove default list styles */
ul,
ol {
  list-style: none;
  padding: 0;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4, h5, h6,
button, input, label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

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

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

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

/* Full button reset */
button {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Focus ring for keyboard users (Tab navigation) — 2px for WCAG 2.4.7 AAA */
:focus-visible {
  outline: 2px solid var(--alpha-white-40);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
button:active {
  box-shadow: none;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* Respect user motion preferences */
@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;
  }
}

/* Support Windows High Contrast Mode */
@media (forced-colors: active) {
  :focus-visible {
    outline-color: Highlight;
  }
  .hp-bar, .charge-bar, .fuel-bar, #xp-bar-track {
    border: 1px solid CanvasText;
  }
  .action-slot {
    border: 1px solid ButtonText;
  }
  .action-slot.disabled {
    opacity: 0.5;
  }
  .action-slot.empowered {
    border-color: Highlight;
  }
  .notification.toast {
    border: 1px solid CanvasText;
  }
  .tint-swatch {
    forced-color-adjust: none;
  }
  .dialogue-choice {
    border: 1px solid ButtonText;
  }
  .dialogue-choice.selected {
    border-color: Highlight;
  }
  .settings-slider::-webkit-slider-thumb {
    forced-color-adjust: none;
    background: Highlight;
  }
  .settings-slider::-moz-range-thumb {
    forced-color-adjust: none;
    background: Highlight;
  }
  .settings-slider::-webkit-slider-runnable-track {
    border: 1px solid CanvasText;
  }
  .settings-slider::-moz-range-track {
    border: 1px solid CanvasText;
  }
  .settings-tab {
    border: 1px solid ButtonText;
  }
  .settings-tab[aria-selected="true"] {
    border-color: Highlight;
  }
  .shop-buy-btn, .shop-sell-btn {
    border: 1px solid ButtonText;
  }
  .launcher-btn {
    border: 1px solid ButtonText;
  }
  .charsel-row[aria-selected="true"] {
    border-color: Highlight;
  }
  #minimap-zoom-in, #minimap-zoom-out {
    border: 1px solid ButtonText;
  }
  .ql-action-btn {
    border: 1px solid ButtonText;
  }
  .telegraph {
    border: 2px solid Highlight;
  }
  .aoe-effect {
    border: 2px solid Highlight;
  }
  dialog::backdrop {
    background: Canvas;
    forced-color-adjust: none;
  }
}

/* High contrast preference — token overrides in _tokens.css (must come after
   the base :root block to win by source order) */
