/**
 * ArenaPulse Base & Reset Styles
 * Global reset, accessible focus rings, typography classes, and utility foundations
 */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--color-surface-dim);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100%;
  background-color: var(--color-surface-dim);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. ACCESSIBILITY & VISIBLE FOCUS STATES
   ========================================================================== */

:focus {
  outline: none;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-secondary-container);
  outline-offset: 2px;
  box-shadow: 0 0 12px rgba(20, 216, 255, 0.4);
}

/* ==========================================================================
   2. SAFE AREA INSETS (Mobile Notches & Home Bars)
   ========================================================================== */

.pt-safe {
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
}

.pb-safe {
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
}

/* ==========================================================================
   3. SCROLLBAR NORMALIZATION
   ========================================================================== */

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

::-webkit-scrollbar-track {
  background: var(--color-surface-container-lowest);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-bright);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-outline);
}

.no-scrollbar::-webkit-scrollbar,
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar,
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   4. ELEMENT RESETS
   ========================================================================== */

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  outline: none;
}

button:disabled,
.btn-disabled {
  cursor: not-allowed !important;
  opacity: 0.5 !important;
  pointer-events: none !important;
}

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

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

/* Material Symbols Default Optimization */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  user-select: none;
}

.material-symbols-outlined.fill-1 {
  font-variation-settings: 'FILL' 1;
}

/* ==========================================================================
   5. GLOBAL TYPOGRAPHY UTILITIES
   ========================================================================== */

.font-display-lg {
  font-family: var(--font-display);
  font-size: var(--text-display-lg);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
}

.font-display-lg-mobile {
  font-family: var(--font-display);
  font-size: var(--text-display-lg-mobile);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.font-display-sm {
  font-family: var(--font-display);
  font-size: var(--text-display-sm);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-feature-settings: 'tnum' on, 'lnum' on;
}

.font-headline-lg {
  font-family: var(--font-display);
  font-size: var(--text-headline-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-normal);
}

.font-headline-sm {
  font-family: var(--font-display);
  font-size: var(--text-headline-sm);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-normal);
}

.font-body-lg {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-loose);
}

.font-body-md {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
}

.font-label-md {
  font-family: var(--font-body);
  font-size: var(--text-label-md);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-single);
  letter-spacing: var(--tracking-wide);
}

.font-label-sm {
  font-family: var(--font-body);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-bold);
  line-height: var(--leading-single);
  letter-spacing: var(--tracking-wider);
}

.font-mono {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' on, 'lnum' on;
}

/* Color Classes */
.text-primary { color: var(--color-primary); }
.text-primary-fixed { color: var(--color-primary-fixed); }
.text-primary-fixed-dim { color: var(--color-primary-fixed-dim); }
.text-primary-container { color: var(--color-primary-container); }
.text-on-primary { color: var(--color-on-primary); }

.text-secondary { color: var(--color-secondary); }
.text-secondary-fixed { color: var(--color-secondary-fixed); }
.text-secondary-fixed-dim { color: var(--color-secondary-fixed-dim); }
.text-secondary-container { color: var(--color-secondary-container); }

.text-error { color: var(--color-error); }
.text-live { color: var(--color-live); }
.text-warning { color: var(--color-warning); }

.text-on-surface { color: var(--color-on-surface); }
.text-on-surface-variant { color: var(--color-on-surface-variant); }
.text-muted { color: var(--color-outline); }

/* Text Utilities */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-medium { font-weight: var(--weight-medium); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
