/*
 * JMC Design System
 * Version: 2.0
 * Date: January 2026
 * Purpose: Unified design system for distinctive, premium brand identity
 */

/* ============================================================
   CSS RESET & BASE STYLES
   ============================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================================ */

:root {
    /* === PRIMARY COLORS === */
    --primary-deep: #0d1b2a;      /* Midnight navy - deepest backgrounds */
    --primary-mid: #1b263b;       /* Rich navy - card backgrounds */
    --primary-light: #415a77;     /* Steel blue - borders, dividers */

    /* === ACCENT COLORS (Professional, Warm) === */
    --accent-primary: #e07a5f;    /* Terracotta - primary CTAs, highlights */
    --accent-secondary: #f2cc8f;  /* Golden sand - secondary accents, hover states */
    --accent-tertiary: #81b29a;   /* Sage green - success states, growth indicators */

    /* === NEUTRAL TONES === */
    --neutral-100: #f8f9fa;       /* Lightest neutral */
    --neutral-200: #e9ecef;       /* Light neutral */
    --neutral-300: #dee2e6;       /* Medium-light neutral */
    --neutral-700: #495057;       /* Dark neutral */
    --neutral-900: #212529;       /* Darkest neutral */

    /* === SEMANTIC COLORS === */
    --color-success: #81b29a;     /* Success states */
    --color-warning: #f2cc8f;     /* Warning states */
    --color-error: #e07a5f;       /* Error states (using terracotta for consistency) */
    --color-info: #3d84b8;        /* Info states */

    /* === TEXT COLORS === */
    --text-primary: #ffffff;                    /* Primary text (white) */
    --text-secondary: rgba(255, 255, 255, 0.85); /* Secondary text */
    --text-muted: rgba(255, 255, 255, 0.65);    /* Muted text */
    --text-disabled: rgba(255, 255, 255, 0.4);  /* Disabled text */

    /* === BACKGROUND COLORS === */
    --bg-primary: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary-mid) 100%);
    --bg-glass: rgba(255, 255, 255, 0.05);      /* Subtle glass effect */
    --bg-glass-hover: rgba(255, 255, 255, 0.08); /* Glass hover state */

    /* === TYPOGRAPHY === */
    --font-display: 'Sora', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Font Weights */
    --weight-light: 300;
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-extrabold: 800;
    --weight-black: 900;

    /* === SPACING SCALE === */
    --space-xs: 0.25rem;      /* 4px */
    --space-sm: 0.5rem;       /* 8px */
    --space-md: 1rem;         /* 16px */
    --space-lg: 1.5rem;       /* 24px */
    --space-xl: 2rem;         /* 32px */
    --space-2xl: 3rem;        /* 48px */
    --space-3xl: 4rem;        /* 64px */
    --space-4xl: 6rem;        /* 96px */

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

    /* === 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);
    --shadow-premium: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(224, 122, 95, 0.4);

    /* === TRANSITIONS === */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* === Z-INDEX SCALE === */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-overlay: 400;
    --z-modal: 500;
    --z-notification: 600;

    /* === LAYOUT === */
    --section-padding: 120px;
    --container-max: 1400px;
    --container-padding: 2rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    :root {
        --section-padding: 60px;
        --container-padding: 1.5rem;
    }
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);   /* 40px → 72px */
    font-weight: var(--weight-extrabold);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);     /* 32px → 56px */
    font-weight: var(--weight-bold);
    letter-spacing: -0.01em;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);  /* 24px → 36px */
    font-weight: var(--weight-semibold);
}

h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem); /* 20px → 28px */
    font-weight: var(--weight-semibold);
}

h5 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);   /* 18px → 24px */
    font-weight: var(--weight-medium);
}

h6 {
    font-size: clamp(1rem, 1.5vw, 1.25rem);    /* 16px → 20px */
    font-weight: var(--weight-medium);
}

/* Display Typography (Hero sections) */
.display-xl {
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, 6rem);         /* 48px → 96px */
    font-weight: var(--weight-black);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-xl);
}

.display-lg {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: var(--weight-extrabold);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* Body Text */
p {
    font-size: clamp(1rem, 1.5vw, 1.125rem);   /* 16px → 18px */
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.body-large {
    font-size: 1.25rem;                        /* 20px */
    line-height: 1.6;
    color: var(--text-secondary);
}

.body-small {
    font-size: 0.875rem;                       /* 14px */
    line-height: 1.5;
    color: var(--text-muted);
}

/* Utility Typography */
.caption {
    font-size: 0.875rem;                       /* 14px */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-gradient {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   LAYOUT & CONTAINERS
   ============================================================ */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
}

.section {
    padding: var(--section-padding) 0;
    position: relative;
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid-cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Flexbox Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ============================================================
   BUTTONS
   ============================================================ */

button,
.btn {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: var(--weight-semibold);
    padding: 1rem 2.5rem;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: var(--primary-deep);
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(224, 122, 95, 0.5);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.btn-tertiary {
    background: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-tertiary:hover {
    background: var(--accent-primary);
    color: var(--primary-deep);
    transform: translateY(-2px);
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1.5rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
}

/* Button States */
.btn:disabled,
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   FORMS
   ============================================================ */

label {
    display: block;
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--bg-glass);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.2);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e07a5f' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

/* Error States */
input.error,
textarea.error,
select.error {
    border-color: var(--color-error);
}

.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: var(--space-sm);
    display: block;
}

/* Success States */
input.success,
textarea.success,
select.success {
    border-color: var(--color-success);
}

/* Checkboxes & Radios */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--space-sm);
}

/* ============================================================
   CARDS
   ============================================================ */

.card,
.glass-card {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    backdrop-filter: blur(24px);
    transition: all var(--transition-base);
}

.card:hover,
.glass-card:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
}

.card-header {
    margin-bottom: var(--space-lg);
}

.card-body {
    margin-bottom: var(--space-lg);
}

.card-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================
   NAVIGATION
   ============================================================ */

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    padding: 1.5rem 0;
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
}

nav.scrolled {
    padding: 1rem 0;
    background: rgba(13, 27, 42, 0.95);
    box-shadow: var(--shadow-lg);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    padding: 0.5rem 1rem;
    transition: color var(--transition-base);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width var(--transition-base);
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link.active {
    color: var(--accent-primary);
}

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

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: var(--primary-deep);
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    font-weight: var(--weight-semibold);
    z-index: var(--z-notification);
    border-radius: 0 0 var(--radius-md) 0;
}

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

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Only animate on desktop with motion preference */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: fadeIn 0.6s ease;
    }

    .fade-in-up {
        animation: fadeInUp 0.8s ease;
    }

    .slide-in-left {
        animation: slideInLeft 0.8s ease;
    }

    .slide-in-right {
        animation: slideInRight 0.8s ease;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   BACKGROUND PATTERNS
   ============================================================ */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
}

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

/* Spacing */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

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

/* Visibility */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* Responsive Utilities */
@media (max-width: 1024px) {
    .hide-mobile {
        display: none;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none;
    }
}
