/* ==========================================================================
   BASE / RESET / TYPOGRAPHY
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--color-on-surface);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}

img, svg, video { max-width: 100%; display: block; }

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

ul, ol { margin: 0; padding: 0; list-style: none; }

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

button { cursor: pointer; }

h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-body); font-weight: 500; }

h1 { font-size: var(--fs-headline-lg-mobile); line-height: var(--lh-headline-lg); }
h2 { font-size: var(--fs-headline-md); line-height: var(--lh-headline-md); }
h3 { font-size: var(--fs-headline-sm); line-height: var(--lh-headline-sm); }
h4 { font-size: var(--fs-title-lg); line-height: var(--lh-title-lg); font-weight: 600; }

p { margin: 0; }

@media (min-width: 768px) {
  h1 { font-size: var(--fs-headline-lg); }
}

.text-display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-display-mobile);
  line-height: var(--lh-display);
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .text-display { font-size: var(--fs-display); }
}

.text-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.text-body-md { font-size: var(--fs-body-md); line-height: var(--lh-body-md); }
.text-label-md {
  font-size: var(--fs-label-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.text-muted { color: var(--color-on-surface-variant); }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-error { color: var(--color-error); }

::selection {
  background: rgba(26, 86, 219, 0.12);
  color: var(--color-primary-dark);
}

/* Focus visibility for keyboard users (accessibility) */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scrollbar (subtle, non-intrusive) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-outline-variant);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-outline); }

/* Skip-to-content link for accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }

/* Utility: visually hidden but accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion preference */
@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;
  }
}
