/**
 * Master CSS - Single Source of Truth for Styles
 * 8-Point Grid System Implementation
 */

/* ============================================
   CSS VARIABLES - Design Tokens
   ============================================ */
:root {
  /* Spacing Scale (8-point grid) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-7: 56px;
  --space-8: 64px;
  --space-9: 72px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;
  --space-20: 160px;
  --space-24: 192px;

  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */
  --text-6xl: 3.75rem;   /* 60px */
  --text-7xl: 4.5rem;    /* 72px */

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Colors */
  --color-primary: #0A4A3B;     /* cedarvis-green */
  --color-secondary: #D4AF37;   /* cedarvis-gold */
  --color-dark: #1A1A1A;        /* cedarvis-dark */
  --color-light: #F5F5F5;       /* cedarvis-light */
  --color-white: #FFFFFF;
  --color-gray-50: #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Border Radius */
  --radius-sm: 0.125rem;
  --radius: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-slower: 500ms ease;
}

/* ============================================
   GLOBAL RESETS AND BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  line-height: var(--leading-normal);
  color: var(--color-gray-800);
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */
.font-space {
  font-family: 'Space Grotesk', sans-serif;
}

.font-jakarta {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Responsive Typography */
.heading-1 {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-6xl));
  line-height: var(--leading-tight);
}

.heading-2 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-5xl));
  line-height: var(--leading-tight);
}

.heading-3 {
  font-size: clamp(var(--text-xl), 3vw, var(--text-4xl));
  line-height: var(--leading-snug);
}

/* ============================================
   SPACING UTILITIES (8-point grid)
   ============================================ */
.section-padding {
  padding: var(--space-10) var(--space-4);
}

@media (min-width: 768px) {
  .section-padding {
    padding: var(--space-16) var(--space-6);
  }
}

@media (min-width: 1024px) {
  .section-padding {
    padding: var(--space-20) var(--space-8);
  }
}

/* ============================================
   NAVBAR STYLES
   ============================================ */
#navbar {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

#navbar.scrolled {
  box-shadow: var(--shadow-lg);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.nav-link {
  position: relative;
  font-weight: 500;
  padding: var(--space-1) 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--transition-base);
}

.nav-link:hover::after {
  width: 100%;
}

/* Dropdown Menu */
.group:hover .group-hover\:opacity-100 {
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  border: none;
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-dark);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-dark);
}

.btn-secondary:hover {
  background: #FFD700;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

/* ============================================
   CARD STYLES
   ============================================ */
.card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.card-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card:hover .card-image img {
  transform: scale(1.05);
}

/* ============================================
   FORM STYLES
   ============================================ */
.form-group {
  margin-bottom: var(--space-3);
}

.form-label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
  color: var(--color-gray-700);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10, 74, 59, 0.1);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* Animation Utilities */
.animate-fade-in {
  animation: fade-in 0.5s ease;
}

.animate-fade-in-up {
  animation: fade-in-up 0.5s ease;
}

.animate-fade-in-down {
  animation: fade-in-down 0.5s ease;
}

.animate-slide-in-left {
  animation: slide-in-left 0.5s ease;
}

.animate-slide-in-right {
  animation: slide-in-right 0.5s ease;
}

.animate-scale-in {
  animation: scale-in 0.5s ease;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Animation Delays */
.animation-delay-100 {
  animation-delay: 100ms;
}

.animation-delay-200 {
  animation-delay: 200ms;
}

.animation-delay-300 {
  animation-delay: 300ms;
}

.animation-delay-400 {
  animation-delay: 400ms;
}

.animation-delay-500 {
  animation-delay: 500ms;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
    padding: 0 var(--space-6);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
    padding: 0 var(--space-8);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-gray-200) 0%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

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

/* ============================================
   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-width: 0;
}

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

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body {
    font-size: 12pt;
  }
  
  .no-print {
    display: none !important;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}

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

::-webkit-scrollbar-track {
  background: var(--color-gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-400);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-gray-100);
}

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

/* ============================================
   SECTION PATTERNS
   ============================================ */
.pattern-dots {
  background-image: radial-gradient(circle, var(--color-gray-300) 1px, transparent 1px);
  background-size: var(--space-4) var(--space-4);
}

.pattern-grid {
  background-image: 
    linear-gradient(var(--color-gray-200) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-gray-200) 1px, transparent 1px);
  background-size: var(--space-4) var(--space-4);
}

.gradient-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #064030 100%);
}

.gradient-secondary {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #FFD700 100%);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-balance {
  text-wrap: balance;
}

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

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

.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-square {
  aspect-ratio: 1 / 1;
}

.aspect-portrait {
  aspect-ratio: 3 / 4;
}