/* ==========================================================================
   MODERN CSS RESET
   Basis-Styles für konsistentes Browser-Verhalten
   
   Dokumentation für Studenten:
   - Resets browser-defaults für konsistente Basis
   - Box-sizing: border-box für intuitive Größenberechnung
   - Keine !important (außer bei a11y-relevanten Styles)
   - Mobile-first Ansatz
   ========================================================================== */

/* ========================================================================
   01. BOX SIZING
   Apply border-box to all elements
   ======================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ========================================================================
   02. MARGIN & PADDING RESET
   Remove default margins and padding
   ======================================================================== */

* {
  margin: 0;
  padding: 0;
}

/* ========================================================================
   03. TYPOGRAPHY RESET
   Consistent font inheritance and rendering
   ======================================================================== */

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%; /* Prevent iOS font scaling */
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ========================================================================
   04. HEADINGS RESET
   Consistent heading styles
   ======================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

/* ========================================================================
   05. LINK RESET
   Remove default link styling, inherit color
   ======================================================================== */

a {
  color: inherit;
  text-decoration: none;
}

a:not([class]) {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:not([class]):hover {
  text-decoration: none;
}

/* ========================================================================
   06. IMAGE & MEDIA RESET
   Responsive images by default
   ======================================================================== */

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

/* ========================================================================
   07. FORM RESET
   Consistent form element styling
   ======================================================================== */

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

/* ========================================================================
   08. LIST RESET
   Remove default list styling
   ======================================================================== */

ul,
ol {
  list-style: none;
}

/* ========================================================================
   09. TABLE RESET
   Consistent table styling
   ======================================================================== */

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ========================================================================
   10. FOCUS STYLES (Accessibility)
   Visible focus indicators for keyboard navigation
   ======================================================================== */

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  background: var(--accent-primary);
  color: white;
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  z-index: var(--z-toast);
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ========================================================================
   11. SELECTION STYLES
   Custom text selection color
   ======================================================================== */

::selection {
  background: var(--accent-primary);
  color: white;
}

/* ========================================================================
   12. SCROLLBAR STYLES (Webkit)
   Custom scrollbar for dark theme
   ======================================================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================================================
   13. REDUCED MOTION
   Respect user 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;
  }
}
