@layer base, utilities;

/* CSS Custom Properties - Theme System */
:root {
  /* Colors */
  --gold: #fbbf24;
  --gold-dark: #f59e0b;
  --navy: #0f172a;
  --navy-dark: #1e293b;
  --navy-light: #334155;
  --cream: #f8fafc;
  --white-glass: hsla(0,0%,100%,0.95);
  
  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 15px 35px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 25px 50px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 40px 80px rgba(0, 0, 0, 0.3);
  --gold-glow: 0 10px 30px rgba(251, 191, 36, 0.4);
  
  /* Spacing Scale */
  --space-xs: clamp(0.5rem, 1.5vw, 0.75rem);
  --space-sm: clamp(1rem, 3vw, 1.5rem);
  --space-md: clamp(2rem, 5vw, 3rem);
  --space-lg: clamp(3rem, 8vw, 5rem);
  
  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;
  --radius-full: 9999px;
  
  /* Z-Index */
  --z-nav: 100;
  --z-fab: 1000;
  --z-modal: 10000;
}

/* Reduced Motion */
@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;
  }
}

/* High Contrast */
@media (prefers-contrast: high) {
  :root {
    --shadow-sm: 0 0 0 2px currentColor;
    --shadow-md: 0 0 0 3px currentColor;
  }
  
  button, [role="button"], a[href] {
    border: 2px solid;
  }
}

/* Focus Visible Ring */
*:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
  scroll-padding-top: clamp(4rem, 10vh, 6rem);
}

/* Selection Colors */
::selection {
  background: var(--gold);
  color: #111827;
}

::-moz-selection {
  background: var(--gold);
  color: #111827;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: clamp(4px, 0.75vw, 6px);
  height: clamp(4px, 0.75vw, 6px);
}

::-webkit-scrollbar-track {
  background: hsla(0,0%,0%,0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(hsla(38,100%,60%,0.6), hsla(38,100%,60%,0.4));
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--gold), var(--gold-dark));
}

/* Print Styles */
@media print {
  .site-header,
  .fab-container,
  .hero-actions,
  .hero-scroll,
  .hero-dots {
    display: none !important;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    background: transparent !important;
    color: black !important;
  }
}

/* Universal Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUpScale {
  from {
    opacity: 0;
    transform: translateY(1.5rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0%, 100% {
    background-position: 200% 0;
  }
  50% {
    background-position: 0 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes badgeFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.5rem);
  }
}

/* Utility Classes */
.fade-in {
  animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.fade-in-scale {
  animation: fadeInUpScale 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.shimmer {
  background: linear-gradient(90deg, transparent, hsla(0,0%,100%,0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.pulse {
  animation: pulse 2s infinite;
}

.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid hsla(0,0%,100%,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Layout Helpers */
.container-fluid {
  width: 100%;
  padding-inline: clamp(1rem, 5vw, 2rem);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }

/* Button Base */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 3rem;
  touch-action: manipulation;
}

.btn-base:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Responsive Text Utilities */
.text-xl { font-size: clamp(1.25rem, 4vw, 1.875rem); }
.text-2xl { font-size: clamp(1.5rem, 5vw, 2.25rem); }
.text-3xl { font-size: clamp(1.875rem, 6vw, 3rem); }
.text-4xl { font-size: clamp(2.25rem, 7vw, 3.5rem); }

/* Grid Utilities */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-lg); }

/* Flex Utilities */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-column { flex-direction: column; }

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, hsla(0,0%,70%,0.3) 25%, hsla(0,0%,70%,0.1) 50%, hsla(0,0%,70%,0.3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Stack for Mobile */
@media (max-width: 480px) {
  .stack-mobile {
    flex-direction: column !important;
    gap: var(--space-sm) !important;
  }
}
