/**
 * CSS Custom Properties (Variables)
 * Church Pictorial Directory - Design System
 *
 * Single source of truth for all colors, spacing, typography, and design tokens.
 * Loaded first in CSS cascade to be available to all other stylesheets.
 */

:root {
  /* =============================================================================
     BRAND COLORS
     ============================================================================= */

  /* Primary Brand Color */
  --brand-primary: #417690;
  --brand-primary-dark: #356578;
  --brand-primary-darker: #2e5670;
  --brand-primary-light: #f0f8ff;

  /* Semantic Colors */
  --brand-success: #28a745;
  --brand-success-dark: #218838;
  --brand-success-darker: #1e7e34;
  --brand-success-bg: #d4edda;
  --brand-success-border: #c3e6cb;
  --brand-success-text: #155724;

  --brand-warning: #ffc107;
  --brand-warning-dark: #e0a800;
  --brand-warning-darker: #d39e00;
  --brand-warning-bg: #fff3cd;
  --brand-warning-border: #ffeeba;
  --brand-warning-alt-border: #ffeaa7;
  --brand-warning-text: #856404;

  --brand-danger: #dc3545;
  --brand-danger-dark: #c82333;
  --brand-danger-darker: #bd2130;
  --brand-danger-bg: #f8d7da;
  --brand-danger-border: #f5c6cb;
  --brand-danger-text: #721c24;
  --brand-danger-alt: #b00020;

  --brand-info: #17a2b8;
  --brand-info-dark: #138496;
  --brand-info-darker: #117a8b;
  --brand-info-bg: #d1ecf1;
  --brand-info-light-bg: #e7f3ff;
  --brand-info-border: #bee5eb;
  --brand-info-text: #0c5460;

  /* Material Design Blue shades (for legacy styles) */
  --material-blue-500: #2196F3;
  --material-blue-700: #1976D2;
  --material-blue-800: #0d47a1;

  /* =============================================================================
     NEUTRAL COLORS (Grayscale)
     ============================================================================= */

  --neutral-white: #ffffff;
  --neutral-50: #f8f9fa;
  --neutral-100: #e9ecef;
  --neutral-200: #dee2e6;
  --neutral-300: #ced4da;
  --neutral-400: #bdc3c7;
  --neutral-500: #95a5a6;
  --neutral-600: #6c757d;
  --neutral-600-dark: #5a6268;
  --neutral-650: #67615a;
  --neutral-700: #495057;
  --neutral-800: #2c3e50;
  --neutral-850: #2c5282;
  --neutral-900: #212529;
  --neutral-black: #000000;

  /* Text Colors (Semantic) */
  --text-primary: #2c3e50;
  --text-secondary: #495057;
  --text-muted: #666666;
  --text-light: #999999;
  --text-inverse: #ffffff;
  --text-inverse-muted: rgba(255, 255, 255, 0.9);  /* For text on dark backgrounds */

  /* Background Colors */
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --bg-gray: #e9ecef;
  --bg-dark: #2c3e50;
  --bg-hover: rgba(0, 0, 0, 0.05);

  /* Border Colors */
  --border-light: #dee2e6;
  --border-medium: #e1e5e9;
  --border-medium-alt: #ddd;
  --border-dark: #ced4da;
  --border-gray: #999;

  /* Badge Colors */
  --badge-secondary-bg: #e2e3e5;
  --badge-secondary-text: #6c757d;

  /* =============================================================================
     DIRECTORY THEME COLORS (Warm, Paper Aesthetic)
     Used for public directory views
     ============================================================================= */

  --directory-paper: #f7f4ef;     /* Warm page background */
  --directory-ink: #2b2b2b;       /* Dark text on paper */
  --directory-card: #ffffff;      /* White cards */
  --directory-rule: #e7e1d6;      /* Subtle tan borders */
  --directory-muted: #67615a;     /* Secondary text */

  /* =============================================================================
     INTAKE FORM COLORS (Optimized for conversion)
     Used for family intake forms
     ============================================================================= */

  --intake-primary: #4a9eff;        /* Primary action blue */
  --intake-primary-hover: #3b82f6;  /* Darker blue on hover */
  --intake-success: #22c55e;        /* Success green (Tailwind green-500) */
  --intake-success-dark: #16a34a;   /* Darker success (green-600) */
  --intake-success-darker: #15803d; /* Even darker (green-700) */
  --intake-success-bg: #f0fdf4;     /* Light green background */
  --intake-danger: #ef4444;         /* Danger red (Tailwind red-500) */
  --intake-danger-bg: #fef2f2;      /* Light red background */
  --intake-disabled: #cbd5e1;       /* Disabled state (slate-300) */
  --intake-bg-field: #fafafa;       /* Light field background */
  --intake-text-dark: #333;         /* Dark text for forms */

  /* =============================================================================
     LANDING PAGE COLORS (Professional Paper Design)
     Used for marketing/landing page (churchpictorial.com/landing/)
     ============================================================================= */

  /* Background colors */
  --landing-bg-page: #faf8f5;     /* Warm off-white paper background */
  --landing-bg-card: #ffffff;     /* Pure white cards */

  /* Border colors */
  --landing-border-default: #e1d5c7;  /* Warm beige borders */
  --landing-border-hover: #417690;    /* Brand blue on hover/focus */

  /* Text colors */
  --landing-text-primary: #2c3e50;    /* Dark slate for headings */
  --landing-text-secondary: #5a6c7d;  /* Medium slate for body text */
  --landing-text-muted: #6c757d;      /* Muted gray for subtle text */

  /* Brand colors (uses global --brand-primary) */
  --landing-brand-primary: var(--brand-primary);        /* #417690 */
  --landing-brand-primary-hover: var(--brand-primary-darker);  /* #2e5670 */

  /* Accent colors */
  --landing-accent-success: var(--brand-success);  /* #28a745 - for savings badges */

  /* Shadows (landing-specific) */
  --landing-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --landing-shadow-md: 0 4px 12px rgba(65, 118, 144, 0.15);
  --landing-shadow-lg: 0 6px 16px rgba(65, 118, 144, 0.2);

  /* Border radius (landing-specific) */
  --landing-radius-sm: 6px;
  --landing-radius-md: 8px;
  --landing-radius-lg: 12px;

  /* =============================================================================
     SPACING SCALE (8px base)
     ============================================================================= */

  --space-0: 0;
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 0.75rem;  /* 12px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;     /* 32px */
  --space-2xl: 3rem;    /* 48px */
  --space-3xl: 4rem;    /* 64px */

  /* =============================================================================
     TYPOGRAPHY
     ============================================================================= */

  /* Font Families */
  --font-family-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Font Sizes */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.85rem;    /* 13.6px */
  --font-size-base: 0.9rem;   /* 14.4px */
  --font-size-md: 1rem;       /* 16px */
  --font-size-lg: 1.1rem;     /* 17.6px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 2rem;      /* 32px */
  --font-size-4xl: 2.5rem;    /* 40px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.1;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;

  /* =============================================================================
     BORDER RADIUS
     ============================================================================= */

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-full: 50%;
  --radius-pill: 999px;

  /* =============================================================================
     SHADOWS
     ============================================================================= */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-focus: 0 0 0 3px rgba(65, 118, 144, 0.1);
  --shadow-focus-ring: 0 0 0 3px rgba(65, 118, 144, 0.25);  /* More visible focus */

  /* Directory-specific shadows (softer) */
  --shadow-directory: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-directory-hover: 0 2px 3px rgba(0,0,0,.05), 0 10px 26px rgba(0,0,0,.08);
  --shadow-directory-focus: 0 0 0 3px rgba(199,191,174,.45), 0 8px 24px rgba(0,0,0,.08);

  /* =============================================================================
     TRANSITIONS
     ============================================================================= */

  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* =============================================================================
     Z-INDEX SCALE
     ============================================================================= */

  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* =============================================================================
     LAYOUT
     ============================================================================= */

  --max-width-xs: 480px;
  --max-width-sm: 640px;
  --max-width-md: 768px;
  --max-width-lg: 1024px;
  --max-width-xl: 1200px;
  --max-width-2xl: 1400px;

  /* Directory-specific layout */
  --max-content-width: 1200px;
  --max-image-width: 900px;
  --header-offset: 96px;

  /* Component sizes */
  --step-number-size: 50px;

  /* =============================================================================
     BREAKPOINTS (for reference in media queries)
     ============================================================================= */

  /* Mobile: < 600px (default) */
  /* Tablet: 600px - 1023px */
  /* Desktop: 1024px+ */

  --breakpoint-sm: 600px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
}

/* =============================================================================
   DARK MODE THEME
   Activated by:
   1. System preference: prefers-color-scheme: dark
   2. Manual toggle: data-theme="dark" on <html> element
   ============================================================================= */

/* Dark mode via system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Brand Colors - Slightly lighter for dark backgrounds */
    --brand-primary: #5a9ab8;
    --brand-primary-dark: #4a8ba8;
    --brand-primary-darker: #3a7a98;
    --brand-primary-light: #1a2a3a;

    /* Semantic Colors - Adjusted for dark mode contrast */
    --brand-success: #4ade80;
    --brand-success-dark: #22c55e;
    --brand-success-bg: rgba(74, 222, 128, 0.15);
    --brand-success-border: rgba(74, 222, 128, 0.3);
    --brand-success-text: #86efac;

    --brand-warning: #fbbf24;
    --brand-warning-dark: #f59e0b;
    --brand-warning-bg: rgba(251, 191, 36, 0.15);
    --brand-warning-border: rgba(251, 191, 36, 0.3);
    --brand-warning-text: #fcd34d;

    --brand-danger: #f87171;
    --brand-danger-dark: #ef4444;
    --brand-danger-bg: rgba(248, 113, 113, 0.15);
    --brand-danger-border: rgba(248, 113, 113, 0.3);
    --brand-danger-text: #fca5a5;

    --brand-info: #38bdf8;
    --brand-info-dark: #0ea5e9;
    --brand-info-bg: rgba(56, 189, 248, 0.15);
    --brand-info-border: rgba(56, 189, 248, 0.3);
    --brand-info-text: #7dd3fc;

    /* Neutral Colors - Inverted */
    --neutral-white: #1a1a1a;
    --neutral-50: #242424;
    --neutral-100: #2d2d2d;
    --neutral-200: #383838;
    --neutral-300: #4a4a4a;
    --neutral-400: #6b6b6b;
    --neutral-500: #8b8b8b;
    --neutral-600: #a1a1a1;
    --neutral-700: #c7c7c7;
    --neutral-800: #e5e5e5;
    --neutral-900: #f5f5f5;
    --neutral-black: #ffffff;

    /* Text Colors */
    --text-primary: #f0f0f0;
    --text-secondary: #d0d0d0;
    --text-muted: #a0a0a0;
    --text-light: #808080;
    --text-inverse: #1a1a1a;

    /* Background Colors */
    --bg-white: #1a1a1a;
    --bg-light: #242424;
    --bg-gray: #2d2d2d;
    --bg-dark: #0d0d0d;
    --bg-hover: rgba(255, 255, 255, 0.05);

    /* Border Colors */
    --border-light: #333333;
    --border-medium: #3d3d3d;
    --border-dark: #4a4a4a;

    /* Directory Theme - Dark variant */
    --directory-paper: #1a1a1a;
    --directory-ink: #e5e5e5;
    --directory-card: #242424;
    --directory-rule: #333333;
    --directory-muted: #a0a0a0;

    /* Landing Page - Dark variant */
    --landing-bg-page: #1a1a1a;
    --landing-bg-card: #242424;
    --landing-border-default: #333333;
    --landing-text-primary: #f0f0f0;
    --landing-text-secondary: #c0c0c0;
    --landing-text-muted: #909090;

    /* Shadows - More subtle in dark mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-focus: 0 0 0 3px rgba(90, 154, 184, 0.3);
    --shadow-directory: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-directory-hover: 0 2px 3px rgba(0, 0, 0, 0.25), 0 10px 26px rgba(0, 0, 0, 0.35);
  }
}

/* Dark mode via manual toggle (data-theme="dark") */
:root[data-theme="dark"] {
  /* Brand Colors */
  --brand-primary: #5a9ab8;
  --brand-primary-dark: #4a8ba8;
  --brand-primary-darker: #3a7a98;
  --brand-primary-light: #1a2a3a;

  /* Semantic Colors */
  --brand-success: #4ade80;
  --brand-success-dark: #22c55e;
  --brand-success-bg: rgba(74, 222, 128, 0.15);
  --brand-success-border: rgba(74, 222, 128, 0.3);
  --brand-success-text: #86efac;

  --brand-warning: #fbbf24;
  --brand-warning-dark: #f59e0b;
  --brand-warning-bg: rgba(251, 191, 36, 0.15);
  --brand-warning-border: rgba(251, 191, 36, 0.3);
  --brand-warning-text: #fcd34d;

  --brand-danger: #f87171;
  --brand-danger-dark: #ef4444;
  --brand-danger-bg: rgba(248, 113, 113, 0.15);
  --brand-danger-border: rgba(248, 113, 113, 0.3);
  --brand-danger-text: #fca5a5;

  --brand-info: #38bdf8;
  --brand-info-dark: #0ea5e9;
  --brand-info-bg: rgba(56, 189, 248, 0.15);
  --brand-info-border: rgba(56, 189, 248, 0.3);
  --brand-info-text: #7dd3fc;

  /* Neutral Colors */
  --neutral-white: #1a1a1a;
  --neutral-50: #242424;
  --neutral-100: #2d2d2d;
  --neutral-200: #383838;
  --neutral-300: #4a4a4a;
  --neutral-400: #6b6b6b;
  --neutral-500: #8b8b8b;
  --neutral-600: #a1a1a1;
  --neutral-700: #c7c7c7;
  --neutral-800: #e5e5e5;
  --neutral-900: #f5f5f5;
  --neutral-black: #ffffff;

  /* Text Colors */
  --text-primary: #f0f0f0;
  --text-secondary: #d0d0d0;
  --text-muted: #a0a0a0;
  --text-light: #808080;
  --text-inverse: #1a1a1a;

  /* Background Colors */
  --bg-white: #1a1a1a;
  --bg-light: #242424;
  --bg-gray: #2d2d2d;
  --bg-dark: #0d0d0d;
  --bg-hover: rgba(255, 255, 255, 0.05);

  /* Border Colors */
  --border-light: #333333;
  --border-medium: #3d3d3d;
  --border-dark: #4a4a4a;

  /* Directory Theme */
  --directory-paper: #1a1a1a;
  --directory-ink: #e5e5e5;
  --directory-card: #242424;
  --directory-rule: #333333;
  --directory-muted: #a0a0a0;

  /* Landing Page */
  --landing-bg-page: #1a1a1a;
  --landing-bg-card: #242424;
  --landing-border-default: #333333;
  --landing-text-primary: #f0f0f0;
  --landing-text-secondary: #c0c0c0;
  --landing-text-muted: #909090;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-focus: 0 0 0 3px rgba(90, 154, 184, 0.3);
  --shadow-directory: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-directory-hover: 0 2px 3px rgba(0, 0, 0, 0.25), 0 10px 26px rgba(0, 0, 0, 0.35);
}
