/**
 * UPDC Design System v1.0 - Design Tokens
 * Saudi Aramco Upstream Professional Development Center
 *
 * Usage:
 *   @import 'updc-design-tokens.css';
 *
 *   or in HTML:
 *   <link rel="stylesheet" href="updc-design-tokens.css">
 *
 * Then reference tokens via CSS custom properties:
 *   background: var(--color-surface);
 *   color: var(--color-text-primary);
 *   box-shadow: var(--shadow-clay-md);
 */

/* ============================================================
   FONT IMPORTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,400&family=Fira+Code:wght@400;500&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* Manifa Pro Variable Font - For Quiz Content */
@font-face {
  font-family: 'Manifa Pro';
  src: url('../Design System/ManifaPro2_2.224 Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   ROOT DESIGN TOKENS
   ============================================================ */
:root {
  /* --------------------------------------------------------
     COLORS - Brand Primary (Official Aramco Palette)
     -------------------------------------------------------- */
  --color-lime: #84BD00;
  --color-green: #00843D;
  --color-cyan: #00A3E0;
  --color-blue: #0033A0;
  --color-charcoal: #323232;
  --color-white: #FFFFFF;

  /* --------------------------------------------------------
     COLORS - Brand Extended (Derived)
     -------------------------------------------------------- */
  --color-lime-light: #E8F4CC;
  --color-lime-dark: #6B9A00;
  --color-green-light: #CCE6D8;
  --color-green-dark: #006B31;
  --color-cyan-light: #CCE9F7;
  --color-cyan-dark: #0082B3;
  --color-blue-light: #CCD6EB;
  --color-blue-dark: #002980;

  /* --------------------------------------------------------
     COLORS - Neutrals
     -------------------------------------------------------- */
  --color-surface: #FAF8F5;
  --color-surface-warm: #F5F0E8;
  --color-surface-card: #FFFFFF;
  --color-border: #E5E5E5;
  --color-border-strong: #D1D1D1;
  --color-text-primary: #1F2937;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;
  --color-text-inverse: #FFFFFF;

  /* --------------------------------------------------------
     COLORS - Semantic
     -------------------------------------------------------- */
  --color-success: var(--color-lime);
  --color-success-bg: var(--color-lime-light);
  --color-info: var(--color-cyan);
  --color-info-bg: var(--color-cyan-light);
  --color-warning: #F59E0B;
  --color-warning-bg: #FEF3C7;
  --color-error: #EF4444;
  --color-error-bg: #FEE2E2;

  /* --------------------------------------------------------
     TYPOGRAPHY - Font Families
     -------------------------------------------------------- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-quiz: 'Manifa Pro', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --font-arabic: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', sans-serif;

  /* --------------------------------------------------------
     TYPOGRAPHY - Font Sizes
     -------------------------------------------------------- */
  --text-display-xl: 3rem;      /* 48px */
  --text-display-lg: 2.5rem;    /* 40px */
  --text-display-md: 2rem;      /* 32px */
  --text-heading-xl: 1.75rem;   /* 28px */
  --text-heading-lg: 1.5rem;    /* 24px */
  --text-heading-md: 1.25rem;   /* 20px */
  --text-heading-sm: 1.1rem;    /* 17.6px */
  --text-body-lg: 1.1rem;       /* 17.6px */
  --text-body-md: 1rem;         /* 16px */
  --text-body-sm: 0.875rem;     /* 14px */
  --text-caption: 0.75rem;      /* 12px */
  --text-overline: 0.7rem;      /* 11.2px */

  /* --------------------------------------------------------
     TYPOGRAPHY - Line Heights
     -------------------------------------------------------- */
  --line-height-tight: 1.25;
  --line-height-snug: 1.35;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  --line-height-loose: 1.75;

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

  /* --------------------------------------------------------
     SPACING
     -------------------------------------------------------- */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1-5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2-5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-3-5: 0.875rem;  /* 14px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-7: 1.75rem;     /* 28px */
  --space-8: 2rem;        /* 32px */
  --space-9: 2.25rem;     /* 36px */
  --space-10: 2.5rem;     /* 40px */
  --space-11: 2.75rem;    /* 44px */
  --space-12: 3rem;       /* 48px */
  --space-14: 3.5rem;     /* 56px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */
  --space-24: 6rem;       /* 96px */
  --space-28: 7rem;       /* 112px */
  --space-32: 8rem;       /* 128px */

  /* --------------------------------------------------------
     BORDER RADIUS
     -------------------------------------------------------- */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-3xl: 32px;
  --radius-full: 9999px;

  /* --------------------------------------------------------
     SHADOWS - Claymorphism (Discovery Mode)
     -------------------------------------------------------- */
  --shadow-clay-sm:
    4px 4px 8px rgba(0, 0, 0, 0.06),
    -2px -2px 6px rgba(255, 255, 255, 0.8),
    inset 1px 1px 1px rgba(255, 255, 255, 0.4);

  --shadow-clay-md:
    8px 8px 16px rgba(0, 0, 0, 0.08),
    -4px -4px 12px rgba(255, 255, 255, 0.9),
    inset 1px 1px 2px rgba(255, 255, 255, 0.5);

  --shadow-clay-lg:
    12px 12px 24px rgba(0, 0, 0, 0.1),
    -6px -6px 16px rgba(255, 255, 255, 0.95),
    inset 1px 1px 3px rgba(255, 255, 255, 0.6);

  --shadow-clay-xl:
    16px 16px 32px rgba(0, 0, 0, 0.12),
    -8px -8px 20px rgba(255, 255, 255, 1),
    inset 2px 2px 4px rgba(255, 255, 255, 0.7);

  /* --------------------------------------------------------
     SHADOWS - Flat (Learning Mode)
     -------------------------------------------------------- */
  --shadow-flat-none: none;
  --shadow-flat-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-flat-md: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-flat-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-flat-xl: 0 8px 16px rgba(0, 0, 0, 0.12);

  /* --------------------------------------------------------
     SHADOWS - Inset (Recessed Elements)
     -------------------------------------------------------- */
  --shadow-inset-sm: inset 2px 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-inset-md: inset 4px 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-inset-lg: inset 6px 6px 12px rgba(0, 0, 0, 0.1);

  /* --------------------------------------------------------
     SHADOWS - Focus Ring
     -------------------------------------------------------- */
  --shadow-focus: 0 0 0 3px var(--color-green-light);
  --shadow-focus-error: 0 0 0 3px var(--color-error-bg);

  /* --------------------------------------------------------
     TRANSITIONS - Durations
     -------------------------------------------------------- */
  --duration-instant: 50ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  --duration-slower: 600ms;

  /* --------------------------------------------------------
     TRANSITIONS - Easing Functions
     -------------------------------------------------------- */
  --easing-default: ease;
  --easing-linear: linear;
  --easing-in: ease-in;
  --easing-out: ease-out;
  --easing-in-out: ease-in-out;
  --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* --------------------------------------------------------
     TRANSITIONS - Presets
     -------------------------------------------------------- */
  --transition-instant: var(--duration-instant) var(--easing-default);
  --transition-fast: var(--duration-fast) var(--easing-default);
  --transition-normal: var(--duration-normal) var(--easing-default);
  --transition-slow: var(--duration-slow) var(--easing-default);
  --transition-bounce: var(--duration-normal) var(--easing-bounce);

  /* --------------------------------------------------------
     LAYOUT - Container Widths
     -------------------------------------------------------- */
  --container-xs: 480px;
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;

  /* --------------------------------------------------------
     LAYOUT - Grid
     -------------------------------------------------------- */
  --grid-columns: 12;
  --grid-gap: var(--space-6);
  --grid-gap-sm: var(--space-4);
  --grid-gap-lg: var(--space-8);

  /* --------------------------------------------------------
     Z-INDEX Scale
     -------------------------------------------------------- */
  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-toast: 600;
  --z-tooltip: 700;
  --z-max: 9999;
}

/* ============================================================
   BASE STYLES
   ============================================================ */

/* Apply surface background and base typography */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
  background-color: var(--color-surface);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Text Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-inverse { color: var(--color-text-inverse); }
.text-lime { color: var(--color-lime); }
.text-green { color: var(--color-green); }
.text-cyan { color: var(--color-cyan); }
.text-blue { color: var(--color-blue); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* Background Colors */
.bg-surface { background-color: var(--color-surface); }
.bg-surface-warm { background-color: var(--color-surface-warm); }
.bg-card { background-color: var(--color-surface-card); }
.bg-lime { background-color: var(--color-lime); }
.bg-lime-light { background-color: var(--color-lime-light); }
.bg-green { background-color: var(--color-green); }
.bg-green-light { background-color: var(--color-green-light); }
.bg-cyan { background-color: var(--color-cyan); }
.bg-cyan-light { background-color: var(--color-cyan-light); }
.bg-blue { background-color: var(--color-blue); }
.bg-blue-light { background-color: var(--color-blue-light); }

/* Font Families */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-quiz { font-family: var(--font-quiz); }
.font-mono { font-family: var(--font-mono); }
.font-arabic { font-family: var(--font-arabic); }

/* Font Weights */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Shadows */
.shadow-clay-sm { box-shadow: var(--shadow-clay-sm); }
.shadow-clay-md { box-shadow: var(--shadow-clay-md); }
.shadow-clay-lg { box-shadow: var(--shadow-clay-lg); }
.shadow-clay-xl { box-shadow: var(--shadow-clay-xl); }
.shadow-flat-sm { box-shadow: var(--shadow-flat-sm); }
.shadow-flat-md { box-shadow: var(--shadow-flat-md); }
.shadow-flat-lg { box-shadow: var(--shadow-flat-lg); }
.shadow-inset-sm { box-shadow: var(--shadow-inset-sm); }

/* Border Radius */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Reduced motion preference */
@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: high) {
  :root {
    --color-border: #000000;
    --color-text-secondary: var(--color-text-primary);
  }
}
