/* 
  Joyceful Grace Redesigned - Color & Typography System
  This file establishes all design tokens as CSS variables
  Import this as the first stylesheet
*/

:root {
  /* ========================================
     COLORS - PRIMARY BRAND PALETTE
     ======================================== */
  --color-primary: #6B32B6;
  --color-primary-light: #E8D7F1;
  --color-primary-dark: #4A1D7F;
  --color-accent-pink: #E85D8A;
  --color-accent-green: #4CAF50;

  /* ========================================
     COLORS - NEUTRAL PALETTE
     ======================================== */
  --color-text-primary: #1F1F2E;
  --color-text-secondary: #6B6B79;
  --color-text-tertiary: #9A9AA8;
  --color-bg-primary: #FFFFFF;
  --color-bg-secondary: #F8F8FB;
  --color-border: #E5E5EA;
  --color-border-light: #F0F0F5;

  /* ========================================
     COLORS - FUNCTIONAL
     ======================================== */
  --color-success: #4CAF50;
  --color-warning: #FF9800;
  --color-error: #E85D8A;
  --color-info: #2196F3;

  /* ========================================
     COLORS - DARK MODE (FOOTER)
     ======================================== */
  --color-dark-bg: #1F1F2E;
  --color-dark-text: #FFFFFF;
  --color-dark-text-muted: rgba(255, 255, 255, 0.7);

  /* ========================================
     SHADOWS
     ======================================== */
  --shadow-sm: 0 2px 8px rgba(31, 31, 46, 0.08);
  --shadow-md: 0 4px 12px rgba(31, 31, 46, 0.12);
  --shadow-lg: 0 8px 24px rgba(31, 31, 46, 0.16);
  --shadow-xl: 0 16px 40px rgba(31, 31, 46, 0.2);

  /* ========================================
     TYPOGRAPHY
     ======================================== */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --font-serif: "Palatino Linotype", "Book Antiqua", Palatino, serif;

  /* Font sizes - Desktop */
  --size-h1: 48px;
  --size-h2: 36px;
  --size-h3: 28px;
  --size-h4: 22px;
  --size-body-large: 18px;
  --size-body: 16px;
  --size-body-small: 14px;
  --size-label: 14px;
  --size-caption: 12px;

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  --line-height-loose: 1.7;

  /* ========================================
     SPACING (8px base unit)
     ======================================== */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Container sizes */
  --container-mobile: calc(100% - 32px);
  --container-tablet: calc(100% - 80px);
  --container-desktop: 1200px;

  /* ========================================
     RADIUS
     ======================================== */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 999px;

  /* ========================================
     Z-INDEX SCALE
     ======================================== */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 50;
  --z-modal-backdrop: 100;
  --z-modal: 101;
  --z-popover: 102;
  --z-tooltip: 103;

  /* ========================================
     TRANSITIONS
     ======================================== */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESPONSIVE FONT SIZES (clamp for fluidity)
   ======================================== */
@media (max-width: 767px) {
  :root {
    --size-h1: clamp(32px, 8vw, 40px);
    --size-h2: clamp(24px, 6vw, 32px);
    --size-h3: clamp(20px, 5vw, 24px);
    --size-h4: clamp(18px, 4vw, 20px);
    --size-body-large: 16px;
    --size-body: 14px;
    --size-body-small: 13px;
    --size-label: 13px;
    --size-caption: 11px;

    /* Mobile padding */
    --container-mobile: calc(100% - 32px);
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  :root {
    --size-h1: clamp(36px, 6vw, 44px);
    --size-h2: clamp(28px, 5vw, 36px);
    --size-h3: clamp(22px, 4vw, 28px);

    /* Tablet padding */
    --container-tablet: calc(100% - 80px);
  }
}

@media (min-width: 1200px) {
  :root {
    /* Desktop uses static sizes from base :root */
    --container-desktop: 1200px;
  }
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }
h4 { font-size: var(--size-h4); }
h5, h6 { font-size: var(--size-label); }

p {
  margin-top: 0;
  margin-bottom: var(--space-md);
  line-height: var(--line-height-relaxed);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-primary-dark);
}

a:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Forms */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-sm);
}

/* ========================================
   BUTTON STYLES
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: var(--size-label);
  font-weight: 600;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  gap: 8px;
  min-height: 44px; /* Mobile touch target */
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

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

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

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-tertiary);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

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

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

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

.btn-small {
  padding: 10px 16px;
  font-size: var(--size-caption);
  min-height: 40px;
}

.btn-large {
  padding: 14px 32px;
  font-size: var(--size-label);
  min-height: 48px;
}

/* ========================================
   CONTAINER & GRID
   ======================================== */
.container {
  width: 100%;
  max-width: var(--container-mobile);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-tablet);
    padding: 0 var(--space-xl);
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: var(--container-desktop);
    padding: 0 var(--space-2xl);
  }
}

/* ========================================
   GRID SYSTEM
   ======================================== */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 767px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .grid-3,
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ========================================
   SECTION SPACING
   ======================================== */
.section {
  padding: var(--space-2xl) 0;
}

.section-sm { padding: var(--space-xl) 0; }
.section-lg { padding: var(--space-3xl) 0; }

@media (max-width: 767px) {
  .section { padding: var(--space-xl) 0; }
  .section-lg { padding: var(--space-2xl) 0; }
}

/* ========================================
   TYPOGRAPHY UTILITIES
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden { display: none !important; }
.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;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

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

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

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

.fade-in {
  animation: fadeIn 400ms ease-out;
}

.slide-up {
  animation: slideUp 400ms ease-out;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@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 mode support */
@media (prefers-contrast: more) {
  :root {
    --color-border: #A0A0A0;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

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

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  a {
    text-decoration: underline;
  }
}
