/**
 * Base Styles - Reset & Typography
 * Following BEM methodology
 */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--color-bg-dark);
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Colors - Valorant Theme */
  --color-primary: #ff4655;
  --color-secondary: #0f1923;
  --color-accent: #53e1ff;

  /* Text Colors */
  --color-text-primary: #ece8e1;
  --color-text-secondary: #9ca3af;
  --color-text-muted: #6b7280;

  /* Background Colors */
  --color-bg-dark: #0f1923;
  --color-bg-darker: #0a0e14;
  --color-bg-panel: rgba(15, 25, 35, 0.95);

  /* Checkpoint Colors */
  --color-checkpoint-inactive: #53e1ff;
  --color-checkpoint-active: #ff4655;
  --color-checkpoint-visited: #fd4556;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.4);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index */
  --z-base: 1;
  --z-overlay: 100;
  --z-modal: 1000;
  --z-notification: 10000;
}

/* ==================== TYPOGRAPHY ==================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}
h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}
h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
}

p {
  margin-bottom: var(--spacing-md);
}

/* ==================== UTILITIES ==================== */
.u-hidden {
  display: none !important;
}
.u-visible {
  display: block !important;
}
.u-text-center {
  text-align: center;
}
.u-text-left {
  text-align: left;
}
.u-text-right {
  text-align: right;
}

/* Margins */
.u-mb-sm {
  margin-bottom: var(--spacing-sm);
}
.u-mb-md {
  margin-bottom: var(--spacing-md);
}
.u-mb-lg {
  margin-bottom: var(--spacing-lg);
}
.u-mb-xl {
  margin-bottom: var(--spacing-xl);
}

/* Padding */
.u-p-sm {
  padding: var(--spacing-sm);
}
.u-p-md {
  padding: var(--spacing-md);
}
.u-p-lg {
  padding: var(--spacing-lg);
}
.u-p-xl {
  padding: var(--spacing-xl);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: var(--radius-md);
}

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

/* ==================== ACCESSIBILITY ==================== */
/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen reader only */
.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;
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* Hardware acceleration for smooth animations */
.story-card,
.story-card__overlay,
.nav,
.game__canvas,
.wish-card,
.loading {
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Smooth scrolling on mobile */
.story-card,
.wishes {
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

/* Prevent text selection during drag */
.game__canvas,
.dpad-btn {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .nav__btn,
  .story-card__close,
  .dpad-btn,
  .wish-form__submit {
    min-width: 44px;
    min-height: 44px;
  }
}