/* ============================================
   BASE STYLES
   - Modern CSS reset
   - Typography defaults
   - Utility classes
   ============================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: var(--app-vh, 100vh);
  transition: background-color var(--t-normal) var(--ease-out),
              color var(--t-normal) var(--ease-out);
}

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

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

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

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

ul, ol {
  list-style: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
  line-height: var(--lh-relaxed);
}

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

/* ===== Scrollbar (global, smooth premium — vertical + horizontal) ===== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-subtle);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

/* ===== Focus styles ===== */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

input:focus, button:focus, select:focus {
  outline: none;
}

/* ===== Container (full-width with fluid padding) ===== */
.container {
  width: 100%;
  padding-inline: var(--container-padding);
}

/* ===== Utility ===== */
.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;
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

.anim-fadeInUp {
  animation: fadeInUp 0.6s var(--ease-out) both;
  will-change: transform, opacity;
}

.anim-fadeIn {
  animation: fadeIn 0.4s var(--ease-out) both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===== Glass Panel Utility ===== */
.glass-panel {
  background-color: var(--color-glass-bg);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: var(--color-glass-backdrop);
  -webkit-backdrop-filter: var(--color-glass-backdrop);
}

/* ===== Glowing Orbs Keyframes ===== */
@keyframes orb-float-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -40px) scale(1.15); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes orb-float-2 {
  0% { transform: translate(0, 0) scale(1.1); }
  50% { transform: translate(-50px, 50px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1.1); }
}

/* Respect 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;
  }
}

/* theme switch: kill all transitions/animations for one frame so light<->dark
   flips instantly instead of every element animating at once (removes lag). */
:root.theme-switching,
:root.theme-switching *,
:root.theme-switching *::before,
:root.theme-switching *::after {
  transition: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}
