/**
 * Base Styles
 * Global resets, variables, and foundational styles
 */

/* CSS Custom Properties (Variables) */
:root {
    /* Color Palette */
    --primary-blue: #1e3a8a;
    --secondary-blue: #3b82f6;
    --accent-blue: #60a5fa;
    --light-blue: #dbeafe;
    --dark-blue: #0f172a;

    --primary-purple: #7c3aed;
    --secondary-purple: #a855f7;
    --accent-purple: #c084fc;
    --light-purple: #ede9fe;

    --neutral-white: #ffffff;
    --neutral-gray-50: #f9fafb;
    --neutral-gray-100: #f3f4f6;
    --neutral-gray-200: #e5e7eb;
    --neutral-gray-300: #d1d5db;
    --neutral-gray-400: #9ca3af;
    --neutral-gray-500: #6b7280;
    --neutral-gray-600: #4b5563;
    --neutral-gray-700: #374151;
    --neutral-gray-800: #1f2937;
    --neutral-gray-900: #111827;

    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --error-red: #ef4444;

    /* Typography */
    --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-secondary: "Poppins", sans-serif;
    --font-mono:
        "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;

    --font-size-xs: 0.75rem; /* 12px */
    --font-size-sm: 0.875rem; /* 14px */
    --font-size-base: 1rem; /* 16px */
    --font-size-lg: 1.125rem; /* 18px */
    --font-size-xl: 1.25rem; /* 20px */
    --font-size-2xl: 1.5rem; /* 24px */
    --font-size-3xl: 1.875rem; /* 30px */
    --font-size-4xl: 2.25rem; /* 36px */
    --font-size-5xl: 3rem; /* 48px */
    --font-size-6xl: 3.75rem; /* 60px */

    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;

    /* Spacing */
    --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 */

    /* Layout */
    --container-max-width: 1200px;
    --container-padding: var(--space-6);

    --header-height: 80px;
    --section-padding: var(--space-20);

    /* Borders */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.5rem;
    --border-radius-full: 9999px;

    --border-width: 1px;
    --border-width-2: 2px;
    --border-width-4: 4px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Glass Morphism */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-backdrop: blur(10px);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    --transition-all: all var(--transition-normal);
    --transition-colors:
        color var(--transition-fast), background-color var(--transition-fast),
        border-color var(--transition-fast);
    --transition-transform: transform var(--transition-normal);
    --transition-opacity: opacity var(--transition-normal);

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Remove default styling */
html {
    line-height: var(--line-height-normal);
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    font-feature-settings: normal;
    font-variation-settings: normal;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--neutral-gray-900);
    background-color: var(--neutral-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Remove default margins */
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
address,
hr,
ol,
ul,
li,
dl,
dt,
dd,
table,
caption,
td,
th,
fieldset,
legend,
figure,
figcaption {
    margin: 0;
    padding: 0;
}

/* Remove list styles */
ol,
ul {
    list-style: none;
}

/* Reset form elements */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
}

button,
select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
    background-color: transparent;
    background-image: none;
    border: 0;
    cursor: pointer;
}

/* Reset fieldset */
fieldset {
    border: 0;
}

/* Reset legend */
legend {
    padding: 0;
}

/* Reset table */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* Reset links */
a {
    color: inherit;
    text-decoration: inherit;
}

/* Reset images */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Reset form inputs */
input,
textarea {
    background-color: transparent;
    border: 0;
    outline: 0;
}

/* Focus styles */
:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::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 {
        --glass-bg: rgba(255, 255, 255, 0.9);
        --glass-border: rgba(0, 0, 0, 0.8);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --neutral-white: var(--neutral-gray-900);
        --neutral-gray-900: #ffffff;
        --glass-bg: rgba(0, 0, 0, 0.3);
        --glass-border: rgba(255, 255, 255, 0.2);
    }
}

/* Print styles */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}
