/**
 * Bookworm Africa Design Tokens
 * CSS Custom Properties for consistent theming
 * Based on brand colors and academic/media personality
 */

:root {
  /* ==========================================================================
     COLOR PALETTE
     Owner-confirmed, WCAG 2.2 AA compliant
     ========================================================================== */

  /* Primary - Maroon tones (brand primary) */
  --color-primary: #6E2832;
  --color-primary-dark: #4A1A22;
  --color-primary-soft: #8F3A47;

  /* Secondary - Gold tones (accent/highlight) - WCAG AA compliant */
  --color-secondary: #D9A03D;
  --color-secondary-deep: #8A5A0F; /* Only gold allowed for text on light backgrounds (5.4:1) */
  --color-secondary-soft: #F3DDAA;

  /* Neutral - Backgrounds */
  --color-bg-cream: #FBF3E3;
  --color-bg-sand: #F1E3C8;
  --color-bg-paper: #FFFFFF;

  /* Neutral - Text */
  --color-text-ink: #2A1A1D;
  --color-text-muted: #6B5558;
  --color-text-light: #A8988A;

  /* Borders */
  --color-border: #E4D5B8;

  /* Overlays */
  --color-overlay-dark: rgba(42, 26, 29, 0.85);
  --color-overlay-medium: rgba(42, 26, 29, 0.65);
  --color-overlay-light: rgba(42, 26, 29, 0.4);

  /* ==========================================================================
     TYPOGRAPHY
     Fluid type scale using clamp() for responsive typography
     Font display: swap for performance
     ========================================================================== */

  /* Font families (self-hosted, no CDN) */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Fluid font sizes */
  --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --font-size-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --font-size-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --font-size-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --font-size-4xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
  --font-size-5xl: clamp(3rem, 2.5rem + 2.5vw, 5rem);

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.4;
  --line-height-normal: 1.65;
  --line-height-relaxed: 1.8;
  --line-height-loose: 2;

  /* Letter spacing */
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.02em;
  --letter-spacing-wider: 0.05em;

  /* ==========================================================================
     SPACING SCALE
     Consistent spacing using 8px base unit
     ========================================================================== */

  --space-0: 0;
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* Section spacing */
  --section-padding-y: clamp(4rem, 8vw, 8rem);
  --section-padding-y-sm: clamp(3rem, 6vw, 6rem);

  /* ==========================================================================
     BORDER RADIUS
     Rounded corners for modern, friendly feel
     ========================================================================== */

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* ==========================================================================
     SHADOWS
     Soft, layered shadows for depth
     ========================================================================== */

  --shadow-sm: 0 1px 2px rgba(42, 26, 29, 0.05);
  --shadow-md: 0 4px 6px rgba(42, 26, 29, 0.07), 0 2px 4px rgba(42, 26, 29, 0.04);
  --shadow-lg: 0 10px 15px rgba(42, 26, 29, 0.1), 0 4px 6px rgba(42, 26, 29, 0.05);
  --shadow-xl: 0 20px 25px rgba(42, 26, 29, 0.12), 0 10px 10px rgba(42, 26, 29, 0.08);
  --shadow-2xl: 0 25px 50px rgba(42, 26, 29, 0.15);

  /* ==========================================================================
     TRANSITIONS
     Smooth, performant animations
     ========================================================================== */

  --transition-fast: 150ms ease-out;
  --transition-base: 250ms ease-out;
  --transition-slow: 350ms ease-out;
  --transition-slower: 500ms ease-out;

  /* Easing functions */
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);

  /* ==========================================================================
     LAYOUT
     Container widths and breakpoints
     ========================================================================== */

  --container-max: 1280px;
  --container-wide: 1440px;
  --content-max: 720px; /* Optimal reading measure ~70 chars */

  /* Breakpoints (for reference in media queries) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1440px;

  /* ==========================================================================
     Z-INDEX SCALE
     Layer management
     ========================================================================== */

  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;

  /* ==========================================================================
     COMPONENT-SPECIFIC TOKENS
     ========================================================================== */

  /* Buttons */
  --btn-padding-y: var(--space-3);
  --btn-padding-x: var(--space-6);
  --btn-font-size: var(--font-size-base);
  --btn-border-radius: var(--radius-full);

  /* Cards */
  --card-padding: var(--space-6);
  --card-border-radius: var(--radius-xl);
  --card-shadow: var(--shadow-md);
  --card-shadow-hover: var(--shadow-lg);

  /* Form inputs */
  --input-padding-y: var(--space-3);
  --input-padding-x: var(--space-4);
  --input-border-radius: var(--radius-md);
  --input-border-color: var(--color-border);
  --input-border-focus: var(--color-secondary-deep);

  /* Header */
  --header-height: 80px;
  --header-height-scrolled: 70px;

  /* Focus rings (accessibility) */
  --focus-ring-width: 3px;
  --focus-ring-color: var(--color-secondary-deep);
  --focus-ring-offset: 2px;
}

/* ==========================================================================
   REDUCED MOTION
   Respect user preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
