/* 
   BioScript Unified Design System (v2.0)
   --------------------------------------
   A comprehensive token-based architecture for premium bio pages.
   Usage: Use CSS variables for all themeable properties.
*/

:root {
    /* --- COLOR PALETTE PRIMITIVES --- */
    /* Neutral Scale (Slate-based for modern feel) */
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-slate-900: #0f172a;
    --color-slate-950: #020617;

    /* Brand Accents (Default: Indigo) */
    --color-brand-light: #e0e7ff;
    --color-brand-DEFAULT: #6366f1;
    --color-brand-dark: #4338ca;

    /* --- SEMANTIC TOKENS (Themeable) --- */
    --bg-page: var(--color-slate-50);
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    
    --text-primary: var(--color-slate-900);
    --text-secondary: var(--color-slate-500);
    --text-tertiary: var(--color-slate-400);
    
    --border-subtle: var(--color-slate-200);
    --border-strong: var(--color-slate-300);
    
    --accent-primary: var(--color-brand-DEFAULT);
    --accent-glow: rgba(99, 102, 241, 0.5);

    /* --- TYPOGRAPHY SCALE (Major Third) --- */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;

    --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 */
    --text-7xl: 4.5rem;   /* 72px */

    /* --- SPACING SYSTEM (4px Grid) --- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* --- LAYOUT --- */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;

    /* --- SHADOWS & ELEVATION --- */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --shadow-neon: 0 0 10px var(--accent-primary), 0 0 20px var(--accent-primary);

    /* --- ADVANCED VISUAL TOKENS --- */
    --gradient-primary: linear-gradient(135deg, var(--color-brand-DEFAULT), var(--color-brand-dark));
    --gradient-warm: linear-gradient(135deg, #fbbf24, #d97706);
    --gradient-cool: linear-gradient(135deg, #38bdf8, #2563eb);
    --gradient-sunset: linear-gradient(135deg, #f43f5e, #7c3aed);
    --gradient-midnight: linear-gradient(to bottom, #0f172a, #1e293b);
    
    --glass-surface: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: 16px;

    /* --- ANIMATION TIMING --- */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
    --duration-slower: 700ms;
}

/* --- DARK MODE OVERRIDES (Apply via .dark class or theme setting) --- */
.theme-dark {
    --bg-page: var(--color-slate-950);
    --bg-surface: var(--color-slate-900);
    --bg-surface-elevated: var(--color-slate-800);
    
    --text-primary: var(--color-slate-50);
    --text-secondary: var(--color-slate-400);
    --text-tertiary: var(--color-slate-500);
    
    --border-subtle: var(--color-slate-800);
    --border-strong: var(--color-slate-700);
}

/* --- UTILITY CLASSES (Prefix: bs-) --- */

/* Text Styles */
.bs-display-lg { font-size: var(--text-6xl); line-height: 1; font-weight: 900; letter-spacing: -0.02em; }
.bs-display-md { font-size: var(--text-5xl); line-height: 1; font-weight: 800; letter-spacing: -0.02em; }
.bs-heading-lg { font-size: var(--text-3xl); line-height: 1.2; font-weight: 700; }
.bs-heading-md { font-size: var(--text-2xl); line-height: 1.3; font-weight: 600; }
.bs-body-lg { font-size: var(--text-lg); line-height: 1.6; }
.bs-body-base { font-size: var(--text-base); line-height: 1.6; }
.bs-caption { font-size: var(--text-xs); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; }

/* Cards */
.bs-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--duration-normal) var(--ease-default);
}

.bs-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

/* Buttons */
.bs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--duration-fast) var(--ease-default);
    cursor: pointer;
}

.bs-btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.bs-btn-primary:hover {
    filter: brightness(110%);
    box-shadow: var(--shadow-glow);
}

.bs-btn-outline {
    background: transparent;
    border: 2px solid var(--border-strong);
    color: var(--text-primary);
}

.bs-btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Glassmorphism Utility */
.bs-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bs-glass-strong {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.bs-neon-border {
    border: 1px solid var(--accent-primary);
    box-shadow: var(--shadow-neon);
}

/* Pattern Overlays */
.bs-pattern-grid {
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.bs-pattern-dots {
    background-image: radial-gradient(var(--text-secondary) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.2;
}

/* Advanced Gradients */
.bs-gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: var(--gradient-primary);
}

.bs-gradient-bg {
    background-image: var(--gradient-primary);
    color: white;
}

.bs-gradient-animated {
    background-size: 200% 200%;
    animation: bsGradientShift 8s ease infinite;
}

/* Advanced Glassmorphism */
.bs-glass-panel {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* Soft UI (Neumorphism-lite) */
.bs-soft-ui {
    background: var(--bg-surface);
    box-shadow: 
        -4px -4px 10px rgba(255,255,255, 0.8),
        4px 4px 10px rgba(0,0,0, 0.05);
    border: 1px solid rgba(255,255,255,0.5);
}

/* Editorial Typography */
.bs-editorial-heading {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

/* Animations */
@keyframes bsFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bsFadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bsSlideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes bsZoomIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes bsBounce { 
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 
    40% {transform: translateY(-10px);} 
    60% {transform: translateY(-5px);} 
}
@keyframes bsGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes bsShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes bsPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}
@keyframes bsShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes bsFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Subtle Animation Utilities */
.bs-anim-pulse { animation: bsPulse 3s infinite ease-in-out; }
.bs-anim-float { animation: bsFloat 6s infinite ease-in-out; }
.bs-anim-shimmer {
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    background-size: 200% 100%;
    animation: bsShimmer 3s infinite linear;
}

/* Page Entrance */
.bs-page-entrance {
    animation: bsFadeIn 0.8s ease-out forwards;
}

/* Reduced Motion & Mobile Optimization */
@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;
    }
}

/* GPU Acceleration for Animations */
.bs-entry-animate,
.bs-hover-animate,
.bs-card,
.bs-btn {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Base Animation Class */
.bs-entry-animate {
    opacity: 0; 
    animation-fill-mode: both;
    animation-duration: var(--animation-duration, 500ms);
    animation-timing-function: var(--ease-out);
    animation-delay: var(--animation-delay, 0ms);
}

/* Context-Aware Entrance Animations */
.anim-entrance-none .bs-entry-animate { opacity: 1; animation: none !important; }

/* Mobile Optimizations */
@media (max-width: 640px) {
    /* Disable heavy blurs on mobile */
    .bs-glass, .bs-glass-strong {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95); /* Fallback to solid */
    }
    .theme-dark .bs-glass, .theme-dark .bs-glass-strong {
        background: rgba(15, 23, 42, 0.95);
    }
    
    /* Simplify shadows */
    .bs-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
}

.anim-entrance-fade-in .bs-entry-animate { animation-name: bsFadeIn; }
.anim-entrance-fade-in-up .bs-entry-animate { animation-name: bsFadeInUp; }
.anim-entrance-slide-in-left .bs-entry-animate { animation-name: bsSlideInLeft; }
.anim-entrance-zoom-in .bs-entry-animate { animation-name: bsZoomIn; }
.anim-entrance-bounce .bs-entry-animate { animation-name: bsBounce; }

/* Context-Aware Hover Animations */
.bs-hover-animate {
    transition: all var(--duration-fast) var(--ease-default);
}
.anim-hover-scale .bs-hover-animate:hover { transform: scale(1.02); }
.anim-hover-lift .bs-hover-animate:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.anim-hover-glow .bs-hover-animate:hover { box-shadow: 0 0 15px var(--accent-glow); border-color: var(--accent-primary); }
.anim-hover-shake .bs-hover-animate:hover { animation: bsShake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

/* Gradient Background Animation */
.anim-bg-gradient {
    background-size: 200% 200%;
    animation: bsGradientShift 6s ease infinite;
}

/* Stagger Utilities */
.bs-delay-100 { animation-delay: calc(var(--animation-delay, 0ms) + 100ms); }
.bs-delay-200 { animation-delay: calc(var(--animation-delay, 0ms) + 200ms); }
.bs-delay-300 { animation-delay: calc(var(--animation-delay, 0ms) + 300ms); }
