/* ═══════════════════════════════════════════════════════════════════════════
   ETHRAEON UNIVERSAL DESIGN SYSTEM (EUDS) — BASE FOUNDATION
   ═══════════════════════════════════════════════════════════════════════════
   
   Constitutional AI Orchestration Platform
   © 2025 S. Jason Prohaska (ingombrante©) — All Rights Reserved
   
   This file provides the foundation layer:
   - CSS Reset (modern, minimal)
   - CSS Custom Properties (design tokens)
   - Typography scale
   - Spacing scale
   - Grid utilities
   - Accessibility defaults
   
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   1. CSS CUSTOM PROPERTIES — CONSTITUTIONAL DESIGN TOKENS
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* ═══════════════════════════════════════════════════════════════
       PRIMARY PALETTE — Constitutional Depth
       ═══════════════════════════════════════════════════════════════ */
    --euds-midnight: #0a0a0f;
    --euds-obsidian: #1a1a2e;
    --euds-slate: #2d2d44;
    --euds-storm: #4a4a6a;
    --euds-mist: #6a6a8a;
    
    /* ═══════════════════════════════════════════════════════════════
       ACCENT PALETTE — Constitutional Action
       ═══════════════════════════════════════════════════════════════ */
    --euds-electric: #00d4ff;
    --euds-cyan: #00ffff;
    --euds-gold: #ffd700;
    --euds-warm-gold: #f4a460;
    --euds-violet: #8b5cf6;
    
    /* ═══════════════════════════════════════════════════════════════
       SEMANTIC PALETTE — Status & Feedback
       ═══════════════════════════════════════════════════════════════ */
    --euds-success: #00ff88;
    --euds-warning: #ffaa00;
    --euds-error: #ff4466;
    --euds-info: #4488ff;
    
    /* ═══════════════════════════════════════════════════════════════
       TEXT HIERARCHY
       ═══════════════════════════════════════════════════════════════ */
    --text-primary: #f5f5f7;
    --text-secondary: rgba(245, 245, 247, 0.7);
    --text-tertiary: rgba(245, 245, 247, 0.5);
    --text-muted: rgba(245, 245, 247, 0.35);
    --text-disabled: rgba(245, 245, 247, 0.2);
    
    /* ═══════════════════════════════════════════════════════════════
       GLASS MORPHISM
       ═══════════════════════════════════════════════════════════════ */
    --glass-bg: rgba(26, 26, 46, 0.7);
    --glass-bg-light: rgba(26, 26, 46, 0.5);
    --glass-bg-strong: rgba(26, 26, 46, 0.9);
    --glass-bg-hover: rgba(26, 26, 46, 0.85);
    --glass-border: rgba(0, 212, 255, 0.12);
    --glass-border-hover: rgba(0, 212, 255, 0.25);
    --glass-border-gold: rgba(255, 215, 0, 0.15);
    --glass-blur: blur(20px);
    --glass-blur-strong: blur(30px);
    
    /* ═══════════════════════════════════════════════════════════════
       SHADOWS
       ═══════════════════════════════════════════════════════════════ */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.15);
    --shadow-glow-strong: 0 0 60px rgba(0, 212, 255, 0.25);
    --shadow-gold-glow: 0 0 30px rgba(255, 215, 0, 0.1);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    /* ═══════════════════════════════════════════════════════════════
       SPACING SCALE (4px base)
       ═══════════════════════════════════════════════════════════════ */
    --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;
    
    /* ═══════════════════════════════════════════════════════════════
       TYPOGRAPHY
       ═══════════════════════════════════════════════════════════════ */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    --font-display: 'Inter', var(--font-sans);
    
    /* Font Sizes */
    --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 */
    --text-6xl: 3.75rem;    /* 60px */
    
    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Letter Spacing */
    --tracking-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    --tracking-widest: 0.1em;
    
    /* ═══════════════════════════════════════════════════════════════
       TRANSITIONS
       ═══════════════════════════════════════════════════════════════ */
    --duration-75: 75ms;
    --duration-100: 100ms;
    --duration-150: 150ms;
    --duration-200: 200ms;
    --duration-300: 300ms;
    --duration-500: 500ms;
    --duration-700: 700ms;
    --duration-1000: 1000ms;
    
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    --transition-fast: var(--duration-150) var(--ease-out);
    --transition-base: var(--duration-200) var(--ease-out);
    --transition-slow: var(--duration-300) var(--ease-out);
    --transition-spring: var(--duration-500) var(--ease-spring);
    
    /* ═══════════════════════════════════════════════════════════════
       Z-INDEX SCALE
       ═══════════════════════════════════════════════════════════════ */
    --z-negative: -1;
    --z-0: 0;
    --z-10: 10;
    --z-20: 20;
    --z-30: 30;
    --z-40: 40;
    --z-50: 50;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-notification: 800;
    
    /* ═══════════════════════════════════════════════════════════════
       BREAKPOINTS (for reference in media queries)
       ═══════════════════════════════════════════════════════════════ */
    /* 
    --screen-sm: 640px;
    --screen-md: 768px;
    --screen-lg: 1024px;
    --screen-xl: 1280px;
    --screen-2xl: 1536px;
    */
}


/* ─────────────────────────────────────────────────────────────────────────────
   2. MODERN CSS RESET
   ───────────────────────────────────────────────────────────────────────────── */

/* Box sizing rules */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margin and padding */
* {
    margin: 0;
    padding: 0;
}

/* Prevent font size inflation */
html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    scroll-behavior: smooth;
}

/* Set core body defaults */
body {
    min-height: 100vh;
    line-height: var(--leading-normal);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Remove default list styles */
ul[role='list'],
ol[role='list'],
ul,
ol {
    list-style: none;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4, h5, h6,
button, input, label {
    line-height: var(--leading-tight);
}

/* Balance text wrapping on headings */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

/* Avoid orphans on paragraphs */
p {
    text-wrap: pretty;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

a:not([class]) {
    text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Make sure textareas without rows get a sensible height */
textarea:not([rows]) {
    min-height: 10em;
}

/* Anything with an id that scrolls to should have extra scroll margin */
:target {
    scroll-margin-block: 5ex;
}

/* Remove all animations and transitions for people who prefer not to see them */
@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ─────────────────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }

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

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }


/* ─────────────────────────────────────────────────────────────────────────────
   4. LAYOUT UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Gap */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* Container */
.container {
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
    padding-inline: var(--space-4);
}

@media (min-width: 640px) {
    .container { padding-inline: var(--space-6); }
}

@media (min-width: 1024px) {
    .container { padding-inline: var(--space-8); }
}


/* ─────────────────────────────────────────────────────────────────────────────
   5. SPACING UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */

/* Margin */
.m-0 { margin: var(--space-0); }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }
.m-auto { margin: auto; }

.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }

.mt-0 { margin-top: var(--space-0); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: var(--space-0); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Padding */
.p-0 { padding: var(--space-0); }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-2 { padding-inline: var(--space-2); }
.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }
.px-8 { padding-inline: var(--space-8); }

.py-2 { padding-block: var(--space-2); }
.py-4 { padding-block: var(--space-4); }
.py-6 { padding-block: var(--space-6); }
.py-8 { padding-block: var(--space-8); }


/* ─────────────────────────────────────────────────────────────────────────────
   6. ACCESSIBILITY UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */

/* Screen reader only */
.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;
}

/* Not screen reader only (for toggling) */
.not-sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible styles */
.focus-visible:focus-visible,
:focus-visible {
    outline: 2px solid var(--euds-electric);
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--euds-electric);
    color: var(--euds-midnight);
    padding: var(--space-2) var(--space-4);
    z-index: var(--z-notification);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}
