/**
 * NEURONIC Design Tokens
 * Conforming to docs/product-specification.md Section 4 and Website Features.pdf Section 6.
 * Supports Light & Dark themes, LTR/RTL logical properties, and reduced-motion modes.
 */

:root {
  /* Typography Families: Microsoft-inspired refined scientific aesthetic */
  --font-heading: 'Segoe UI Variable Display', 'Segoe UI', 'Aptos Display', 'Aptos', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, sans-serif;
  --font-display: 'Segoe UI Variable Display', 'Segoe UI', 'Aptos Display', 'Aptos', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, sans-serif;
  --font-body: 'Segoe UI Variable Text', 'Segoe UI', 'Aptos', 'Inter', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-persian: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, Menlo, monospace;

  /* Spacing Scale (8-point grid) */
  --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 */

  /* Layout Spacing Architecture Tokens (Header / Footer / Section Rhythm) */
  --layout-header-spacing: clamp(2.5rem, 5vw, 4rem);    /* 40px mobile -> 64px desktop */
  --layout-footer-spacing: clamp(4rem, 7vw, 5.5rem);    /* 64px mobile -> 88px desktop */
  --layout-section-spacing: clamp(2.5rem, 5vw, 4rem);   /* 40px mobile -> 64px desktop */

  /* Border Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography Scales */
  --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 */

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-persian: 1.8;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(10, 26, 51, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(10, 26, 51, 0.06), 0 2px 4px -2px rgba(10, 26, 51, 0.03);
  --shadow-lg: 0 12px 24px -4px rgba(10, 26, 51, 0.08), 0 4px 8px -4px rgba(10, 26, 51, 0.04);
  --shadow-card: 0 1px 3px rgba(10, 26, 51, 0.04), 0 1px 2px rgba(10, 26, 51, 0.02);
  --shadow-card-hover: 0 8px 24px -4px rgba(10, 26, 51, 0.08), 0 2px 6px -1px rgba(10, 26, 51, 0.03);
}

/* Light Theme (Default) */
:root,
:root[data-theme="light"] {
  --color-canvas: #FAF8F5;          /* Warm Clinical Ivory Canvas */
  --color-surface: #FFFFFF;         /* Pure Architectural White */
  --color-surface-hover: #F4F1EA;
  --color-text: #0A1A33;            /* Slate Midnight Ink (from brand logo) */
  --color-muted: #536275;           /* Refined Slate Gray */
  --color-brand: #0A1A33;           /* Midnight Obsidian Navy */
  --color-brand-hover: #152744;
  --color-brand-contrast: #FFFFFF;
  --color-science: #0D9488;         /* Clinical Teal */
  --color-science-hover: #0F766E;
  --color-accent-gold: #8A6224;     /* Bronze Gold (from brand logo) */
  --color-accent-gold-hover: #704F1D;
  --color-secondary-accent: #3A4E7A;/* Subdued Slate Navy */
  --color-border: #E5E0D8;          /* Warm Architectural Neutral */
  --color-border-hover: #D0C9BE;

  /* Aliases for template compatibility */
  --color-foreground: #0A1A33;
  --color-primary: #0A1A33;
  --color-secondary: #0D9488;

  /* Logo Tokens */
  --logo-primary: #0A1A33;
  --logo-primary-faint: rgba(10, 26, 51, 0.45);
  --logo-accent: #8A6224;
  --logo-center-fill: #FAF7F2;

  /* Semantic Feedback */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-danger: #DC2626;
  --color-danger-bg: #FEF2F2;
  --color-info: #0A1A33;
  --color-info-bg: #EFF6FF;

  /* Accessible Focus Ring (WCAG 2.2 AA) */
  --color-focus-ring: #0A1A33;
  --focus-outline: 3px solid var(--color-focus-ring);
  --focus-offset: 2px;
}

/* Dark Theme */
:root[data-theme="dark"] {
  --color-canvas: #070D18;          /* Deep Obsidian Navy */
  --color-surface: #0F1A2C;         /* Graphite Slate Surface */
  --color-surface-hover: #16243C;
  --color-text: #F2EEE6;            /* Frost Linen White (from logo dark) */
  --color-muted: #96A3B5;           /* Silver Slate Gray */
  --color-brand: #F2EEE6;           /* Frost White */
  --color-brand-hover: #FFFFFF;
  --color-brand-contrast: #070D18;
  --color-science: #42D6C6;         /* Aqua Teal */
  --color-science-hover: #67E8F9;
  --color-accent-gold: #D4AE72;     /* Luminous Amber Gold (from logo dark) */
  --color-accent-gold-hover: #E2BE86;
  --color-secondary-accent: #91A2FF;
  --color-border: #1E2D44;          /* Slate Navy Border */
  --color-border-hover: #2C3F5E;

  /* Aliases for template compatibility */
  --color-foreground: #F2EEE6;
  --color-primary: #F2EEE6;
  --color-secondary: #42D6C6;

  /* Logo Tokens */
  --logo-primary: #F2EEE6;
  --logo-primary-faint: rgba(242, 238, 230, 0.4);
  --logo-accent: #D4AE72;
  --logo-center-fill: #0A1A33;

  /* Semantic Feedback (Dark) */
  --color-success: #34D399;
  --color-success-bg: rgba(5, 150, 105, 0.15);
  --color-warning: #FBBF24;
  --color-warning-bg: rgba(217, 119, 6, 0.15);
  --color-danger: #F87171;
  --color-danger-bg: rgba(220, 38, 38, 0.15);
  --color-info: #60A5FA;
  --color-info-bg: rgba(37, 99, 235, 0.15);

  --color-focus-ring: #D4AE72;
  --focus-outline: 3px solid var(--color-focus-ring);
  --focus-offset: 2px;
}

/* Auto Theme based on user OS preference when data-theme is system or unset */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"],
  :root:not([data-theme]) {
    --color-canvas: #070D18;
    --color-surface: #0F1A2C;
    --color-surface-hover: #16243C;
    --color-text: #F2EEE6;
    --color-muted: #96A3B5;
    --color-brand: #F2EEE6;
    --color-brand-hover: #FFFFFF;
    --color-brand-contrast: #070D18;
    --color-science: #42D6C6;
    --color-science-hover: #67E8F9;
    --color-accent-gold: #D4AE72;
    --color-accent-gold-hover: #E2BE86;
    --color-secondary-accent: #91A2FF;
    --color-border: #1E2D44;
    --color-border-hover: #2C3F5E;

    /* Aliases for template compatibility */
    --color-foreground: #F2EEE6;
    --color-primary: #F2EEE6;
    --color-secondary: #42D6C6;

    --logo-primary: #F2EEE6;
    --logo-primary-faint: rgba(242, 238, 230, 0.4);
    --logo-accent: #D4AE72;
    --logo-center-fill: #0A1A33;

    --color-success: #34D399;
    --color-success-bg: rgba(5, 150, 105, 0.15);
    --color-warning: #FBBF24;
    --color-warning-bg: rgba(217, 119, 6, 0.15);
    --color-danger: #F87171;
    --color-danger-bg: rgba(220, 38, 38, 0.15);
    --color-info: #60A5FA;
    --color-info-bg: rgba(37, 99, 235, 0.15);

    --color-focus-ring: #D4AE72;
    --focus-outline: 3px solid var(--color-focus-ring);
    --focus-offset: 2px;
  }
}

/* Reduced Motion Mode */
@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;
  }
}
