/* ============================================================
   Matchic — Base Styles v2
   Liquid Glass Design System
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  line-height: var(--leading-relaxed);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--duration-normal) var(--ease-out-cubic),
              color var(--duration-normal) var(--ease-out-cubic);
}

/* Ambient background glow (Flutter: animated gradient backgrounds) */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 800px 500px at 20% 30%, rgba(33, 150, 243, 0.07), transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 20%, rgba(3, 218, 198, 0.05), transparent 70%);
  z-index: -1;
  pointer-events: none;
  animation: ambient-glow 20s ease-in-out infinite alternate;
}

@keyframes ambient-glow {
  0% { opacity: 0.6; transform: translate(0, 0) scale(1); }
  50% { opacity: 1; transform: translate(2%, 1%) scale(1.02); }
  100% { opacity: 0.6; transform: translate(-1%, -2%) scale(1); }
}

/* Selection */
::selection {
  background: var(--primary-alpha-strong);
  color: var(--text);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 4px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-visible);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

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

h1 { font-size: var(--text-display-lg); }
h2 { font-size: var(--text-display-md); }
h3 { font-size: var(--text-headline-lg); }
h4 { font-size: var(--text-headline-md); }
h5 { font-size: var(--text-headline-sm); }
h6 { font-size: var(--text-title-lg); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

p.lead {
  font-size: var(--text-body-lg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-cubic);
}

a:hover {
  color: var(--primary-variant);
  text-decoration: underline;
}

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

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

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-primary { color: var(--text); }
.text-secondary { color: var(--text-secondary); }
.text-disabled { color: var(--text-disabled); }
.text-hint { color: var(--text-hint); }

.bg-primary { background: var(--primary); }
.bg-surface { background: var(--surface); }
.bg-elevated { background: var(--surface-high); }

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.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;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: var(--on-primary);
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

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

/* ============================================================
   REDUCED MOTION
   ============================================================ */

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