/* 
 * Reset CSS
 * 
 * A comprehensive reset stylesheet to normalize default styling across browsers
 * and provide a clean baseline for the rosenqvist.design website.
 */

/* 
 * Box Sizing
 * Apply a more intuitive box-sizing model globally
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 
 * Document & Body Reset
 * Remove default margin and set base styles
 */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 
 * Typography Reset
 * Reset typography elements to have no margin and use inheritance
 */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* 
 * List Reset
 * Remove default padding, margin and list styling
 */
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 
 * Form Reset
 * Reset form elements to ease styling
 */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

button {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Remove autofill background color */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  transition: background-color 5000s ease-in-out 0s;
}

/* Disable default appearance for certain elements */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* Remove spin buttons from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* 
 * Media Reset
 * Make images and videos more responsive
 */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 
 * Link Reset
 * Reset link styling
 */
a {
  text-decoration: none;
  color: inherit;
}

/* 
 * Table Reset
 * Reset table styles
 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* 
 * Hidden Attribute
 * Improve the styling of the [hidden] attribute
 */
[hidden] {
  display: none !important;
}

/* 
 * Focus Outline
 * Remove outline for mouse users but keep it for keyboard navigation
 */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-primary, #a0000c);
  outline-offset: 2px;
}

/* 
 * Selection Styling
 * Style text selection
 */
::selection {
  background-color: var(--color-primary, #a0000c);
  color: var(--color-neutral-50, #ffffff);
}

/* 
 * Remove animations and transitions for users with reduced 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;
  }
}
