/**
 * Modern CSS Reset - 1.wien
 * Based on modern best practices for cross-browser consistency
 */

/* ============================================
   BOX SIZING
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ============================================
   REMOVE DEFAULT MARGIN & PADDING
   ============================================ */
* {
  margin: 0;
  padding: 0;
}

/* ============================================
   HTML & BODY
   ============================================ */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100vh;
  line-height: 1.5;
  text-rendering: optimizeSpeed;
  /* Critical: Prevent FOUC with deferred CSS */
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  line-height: 1.2;
}

p, li, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ============================================
   MEDIA
   ============================================ */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  fill: currentColor;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Remove default button styles */
button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/* ============================================
   LISTS
   ============================================ */
ul, ol {
  list-style: none;
}

/* ============================================
   LINKS
   ============================================ */
a {
  color: inherit;
  text-decoration: none;
}

/* ============================================
   TABLES
   ============================================ */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Remove all animations and transitions for people who prefer not to see them */
@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;
  }
}

/* Improve text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to main content link for keyboard users */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-cyan);
  color: var(--color-dark);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 9999;
  border-radius: 0 0 4px 0;
  font-weight: 600;
}

.skip-to-main:focus {
  top: 0;
}

/* ============================================
   FIXES FOR SPECIFIC ELEMENTS
   ============================================ */

/* Remove spinner arrows 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;
}

/* Remove default search input styling */
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 {
  -webkit-appearance: none;
}

/* Consistent textarea resize */
textarea {
  resize: vertical;
}

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

:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}
