/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background-color: #f8fafc;
}

/* Tesla-inspired theme tokens */
:root {
    --brand-red: #E31937;
    --brand-charcoal: #171A20;
    --brand-graphite: #222426;
    --brand-silver: #E5E7EB;
    --brand-pearl: #FAFAFA;
    --brand-blue: #1F3A8A;
}

/* Utility classes */
.text-brand-red { color: var(--brand-red); }
.bg-brand-red { background-color: var(--brand-red); }
.text-brand-charcoal { color: var(--brand-charcoal); }
.bg-brand-charcoal { background-color: var(--brand-charcoal); }
.text-brand-blue { color: var(--brand-blue); }
.bg-brand-blue { background-color: var(--brand-blue); }
.bg-brand-pearl { background-color: var(--brand-pearl); }
.bg-brand-silver { background-color: var(--brand-silver); }
.border-brand-red { border-color: var(--brand-red); }

/* Gradient CTAs */
.gradient-cta {
    background-image: linear-gradient(135deg, var(--brand-red), #b91c1c 60%, var(--brand-charcoal));
}

/* Colored chips for stats/icons */
.chip-red {
    background-color: color-mix(in srgb, var(--brand-red) 12%, #fff);
    color: var(--brand-red);
}

.chip-charcoal {
    background-color: color-mix(in srgb, var(--brand-charcoal) 10%, #fff);
    color: var(--brand-charcoal);
}

.chip-graphite {
    background-color: color-mix(in srgb, var(--brand-graphite) 12%, #fff);
    color: var(--brand-graphite);
}

.chip-blue {
    background-color: color-mix(in srgb, var(--brand-blue) 12%, #fff);
    color: var(--brand-blue);
}

.chip-silver {
    background-color: color-mix(in srgb, var(--brand-silver) 60%, #fff);
    color: #374151;
}

.chip-pearl {
    background-color: var(--brand-pearl);
    color: #374151;
    border: 1px solid var(--brand-silver);
}

/* Fallback for browsers that don't support color-mix */
@supports not (color-mix: in srgb, black 50%, white) {
    .chip-red { background: #fee2e2; color: #991b1b; }
    .chip-charcoal { background: #f1f5f9; color: #0f172a; }
    .chip-graphite { background: #e5e7eb; color: #111827; }
    .chip-blue { background: #e0e7ff; color: #1e40af; }
    .chip-silver { background: #f3f4f6; color: #374151; }
    .chip-pearl { background: #fafafa; color: #374151; border: 1px solid #e5e7eb; }
}

/* Page background with soft brand-tinted blobs */
.page-surface {
    background:
        radial-gradient(1000px 600px at -10% -20%, color-mix(in srgb, var(--brand-red) 12%, #fff) 0%, transparent 60%),
        radial-gradient(800px 500px at 110% -10%, color-mix(in srgb, var(--brand-blue) 12%, #fff) 0%, transparent 60%),
        linear-gradient(180deg, var(--brand-pearl), #ffffff 40%);
}

/* Alternate section tints for visual rhythm */
.site-section:nth-of-type(odd) {
    background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--brand-silver) 45%, #fff) 80%);
}

.site-section:nth-of-type(even) {
    background:
        radial-gradient(600px 360px at 10% 10%, color-mix(in srgb, var(--brand-red) 6%, #fff) 10%, transparent 60%),
        radial-gradient(600px 360px at 90% 0%, color-mix(in srgb, var(--brand-blue) 6%, #fff) 10%, transparent 60%);
}

/* Layout utilities */
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-7xl { max-width: 80rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }

/* Grid system */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Flexbox utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-8 { margin-bottom: 2rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-16 { padding-top: 4rem; }
.pb-10 { padding-bottom: 2.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-10 { padding: 2.5rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Colors */
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-slate-800 { color: #1e293b; }
.text-slate-900 { color: #0f172a; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-white { color: #ffffff; }

.bg-white { background-color: #ffffff; }
.bg-slate-50 { background-color: #f8fafc; }
.bg-red-50 { background-color: #fef2f2; }
.bg-gradient-to-b { background-image: linear-gradient(to bottom, var(--tw-gradient-stops)); }
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.from-white { --tw-gradient-from: #ffffff; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(255, 255, 255, 0)); }
.to-red-50\/40 { --tw-gradient-to: rgba(254, 242, 242, 0.4); }
.from-red-50\/40 { --tw-gradient-from: rgba(254, 242, 242, 0.4); }
.via-white { --tw-gradient-stops: var(--tw-gradient-from), #ffffff, var(--tw-gradient-to, rgba(255, 255, 255, 0)); }
.to-blue-50\/40 { --tw-gradient-to: rgba(239, 246, 255, 0.4); }

/* Borders */
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-slate-200 { border-color: #e2e8f0; }
.border-white { border-color: #ffffff; }
.rounded-md { border-radius: 0.375rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }

/* Shadows */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

/* Positioning */
.sticky { position: sticky; }
.top-0 { top: 0px; }
.z-50 { z-index: 50; }

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

/* Sizing */
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-9 { width: 2.25rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }

/* Aspect ratios */
.aspect-\[4\/3\] { aspect-ratio: 4 / 3; }

/* Responsive utilities */
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
    .sm\:text-5xl { font-size: 3rem; line-height: 1; }
}

@media (min-width: 768px) {
    .md\:flex { display: flex; }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:justify-end { justify-content: flex-end; }
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Component styles */

/* Header */
header {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Navigation */
.nav-btn {
    position: relative;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    color: #1e293b;
}

.nav-btn:hover {
    color: var(--brand-red);
}

.nav-btn.active {
    color: var(--brand-red);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background-color: var(--brand-red);
}

/* Buttons */
.btn-primary {
    background-color: var(--brand-red);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #b91c1c;
}

.btn-outline {
    background-color: transparent;
    color: #1e293b;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-white {
    background-color: white;
    color: var(--brand-red);
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-white:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.btn-outline-white {
    background-color: transparent;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    border: 1px solid white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-outline-white:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Pills */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Feature stats */
.feature-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.feature-stat > div:first-child {
    display: grid;
    place-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
}

/* Impact stats */
.impact-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.impact-stat > div:first-child {
    display: grid;
    place-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background-color: color-mix(in srgb, var(--brand-charcoal) 10%, #fff);
    color: var(--brand-charcoal);
}

/* Service tiles */
.service-tile {
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    padding: 1.5rem;
    border-radius: 1rem;
    background-color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.service-tile:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(227, 25, 55, 0.2);
}

.service-tile h3 {
    margin-top: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

.service-tile p {
    margin-top: 0.5rem;
    color: #475569;
}

/* Page navigation */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Form elements */
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(227, 25, 55, 0.1);
}

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

a:hover {
    color: var(--brand-red);
}

/* Lists */
ul {
    list-style: none;
}

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Responsive text */
@media (min-width: 640px) {
    .text-4xl\/tight { line-height: 1; }
    .text-5xl\/tight { line-height: 1; }
}

/* Hover effects */
.hover\:text-red-700:hover {
    color: #b91c1c;
}

.hover\:border-slate-300:hover {
    border-color: #cbd5e1;
}

/* Animation utilities */
.transition {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Backdrop blur */
.backdrop-blur {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Ring utilities */
.ring-1 {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Opacity utilities */
.opacity-30 {
    opacity: 0.3;
}

.opacity-90 {
    opacity: 0.9;
}

/* Z-index utilities */
.z-50 {
    z-index: 50;
}

/* Select utilities */
.select-none {
    user-select: none;
}

/* Grid place utilities */
.place-content-center {
    place-content: center;
}

/* Aspect ratio utilities */
.aspect-\[4\/3\] {
    aspect-ratio: 4 / 3;
}

/* Text utilities */
.uppercase {
    text-transform: uppercase;
}

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

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

/* Overflow utilities */
.overflow-hidden {
    overflow: hidden;
}

/* Position utilities */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.-z-10 {
    z-index: -10;
}

/* Transform utilities */
.scale-1\.02 {
    transform: scale(1.02);
}

.-bottom-\[2px\] {
    bottom: -2px;
}

/* Animation for impact stats */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.impact-stat {
    animation: countUp 0.6s ease-out;
}

/* Mobile menu (basic) */
@media (max-width: 768px) {
    .hidden {
        display: none;
    }
    
    /* Add mobile menu button */
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
    }
    
    /* Mobile navigation */
    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 100;
        padding: 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-nav.active {
        transform: translateX(0);
    }
}