/* Infrastructure Base Styles */

:root {
    /* Brand Colors */
    --cerebras: #f59e0b;
    --cerebras-dark: #d97706;
    --ddn: #ef4444;
    --ddn-dark: #dc2626;
    --sky: #0ea5e9;
    
    /* Slate palette */
    --slate-950: #020617;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    
    /* Layout tokens */
    --nav-height: 5rem;
    --container-max: 80rem;
    --container-padding: 1.5rem;
    
    /* Spacing scale (standardized) */
    --gap-sm: 1rem;
    --gap-md: 1.5rem;
    --gap-lg: 2rem;
    --gap-xl: 3rem;
    
    /* Border radius scale */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--amber);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
    font-weight: 700;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Modern scroll-margin for fixed nav */
[id] {
    scroll-margin-top: var(--nav-height);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--slate-950);
    color: white;
    line-height: 1.6;
}

/* Fluid typography with clamp() */
.text-fluid-hero { font-size: clamp(3rem, 8vw, 5rem); }
.text-fluid-heading { font-size: clamp(2rem, 5vw, 3rem); }
.text-fluid-subheading { font-size: clamp(1.125rem, 2.5vw, 1.5rem); }
.text-fluid-body { font-size: clamp(1rem, 1.5vw, 1.125rem); }

/* Modern container with min() */
.container-modern {
    width: min(var(--container-max), 100% - var(--container-padding) * 2);
    margin-inline: auto;
}

/* Logical properties for RTL support */
.ps-6 { padding-inline-start: 1.5rem; }
.pe-6 { padding-inline-end: 1.5rem; }
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }
.border-s-2 { border-inline-start-width: 2px; }

/* Dynamic viewport height for mobile */
.min-h-dvh { min-height: 100dvh; }
.h-dvh { height: 100dvh; }

/* Isolation for z-index stacking contexts */
.isolate { isolation: isolate; }

/* Typography */
.font-brand {
    font-family: 'Quicksand', sans-serif;
}

.text-gradient-amber {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-sky {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 50%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.nav-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-link:hover {
    color: #f59e0b;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-weight: 700;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(245, 158, 11, 0.35);
}

.btn-hero-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.3);
}

.btn-hero-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.4);
}

.btn-hero-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--slate-800);
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 0.75rem;
    border: 1px solid var(--slate-600);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-hero-secondary:hover {
    background: var(--slate-700);
    border-color: var(--slate-500);
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: var(--gap-xl);
}

.section-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--slate-400);
}

/* Badges */
.badge-amber {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-red {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Hero Section */
.hero-section {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center top, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
                radial-gradient(ellipse at center bottom, rgba(239, 68, 68, 0.1) 0%, transparent 50%);
    z-index: 1;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 1;
}

/* Stats Cards */
.stat-card {
    padding: 1.5rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--slate-700);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Inter', monospace;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mobile Navigation */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--slate-800);
    border: 1px solid var(--slate-700);
    border-radius: 0.75rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-link:hover {
    background: var(--slate-700);
    border-color: var(--amber);
    transform: translateX(4px);
}

/* Form Inputs */
.slider-container {
    position: relative;
}

.slider-input {
    width: 100%;
    height: 0.5rem;
    background: var(--slate-600);
    border-radius: 9999px;
    appearance: none;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.slider-input::-webkit-slider-runnable-track {
    height: 0.5rem;
    border-radius: 9999px;
}

.slider-input::-webkit-slider-thumb {
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4), 0 0 0 4px rgba(245, 158, 11, 0.1);
    margin-top: -0.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5), 0 0 0 6px rgba(245, 158, 11, 0.15);
}

.slider-input::-webkit-slider-thumb:active {
    transform: scale(0.95);
}

.slider-input::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4), 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.slider-input::-moz-range-progress {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    height: 0.5rem;
    border-radius: 9999px;
}

/* Slider fill track (for webkit) */
.slider-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 0.5rem;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border-radius: 9999px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 0;
}

/* Slider value tooltip */
.slider-tooltip {
    position: absolute;
    top: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 0.75rem;
    background: var(--amber);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.slider-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--amber);
}

.slider-container:hover .slider-tooltip,
.slider-input:focus + .slider-tooltip {
    opacity: 1;
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--slate-700);
    border: 1px solid var(--slate-600);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input::placeholder {
    color: var(--slate-500);
}

.form-input:hover {
    border-color: var(--slate-500);
}

.form-input:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

textarea.form-input {
    min-height: 80px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--slate-900);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-600);
}

/* Responsive - fluid typography removes most need for breakpoint overrides */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.75rem;
    }
    
    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100%;
    }
}

/* Extra large screens */
@media (min-width: 1280px) {
    :root {
        --container-padding: 2rem;
    }
}

@media (min-width: 1536px) {
    :root {
        --container-max: 90rem;
    }
}
