/* SEO Optimized Styles - Fix for Core Web Vitals */

/* Global Styles */
:root {
    --primary: #135bec;
    --bg-light: #f6f6f8;
    --bg-dark: #101622;
    --text-dark: #111318;
    --text-light: #616f89;
}

/* Prevent Layout Shift - Fixed navbar */
html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Navbar - Fixed positioning to prevent shift */
nav.sticky {
    contain: layout style paint;
    will-change: transform;
}

nav {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Container - Define max-width early to prevent shift */
.max-w-\[1280px\] {
    max-width: 1280px;
}

.max-w-\[960px\] {
    max-width: 960px;
}

/* Main content area - Prevent shift */
main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Sections - Prevent layout shift */
section {
    contain: layout style paint;
}

/* Cards - Define heights to prevent shift */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    will-change: transform;
}

/* Buttons - Fixed height to prevent shift */
button,
a[class*="btn"],
.bg-primary {
    height: auto;
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

button:hover,
a[class*="btn"]:hover {
    transform: translateY(-2px);
}

/* Images - Define aspect ratio to prevent shift */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Typography - Fixed line heights */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5em;
    line-height: 1.2;
    font-weight: 700;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
    line-height: 1.6;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* Forms - Fixed sizes */
input,
textarea,
select {
    box-sizing: border-box;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(19, 91, 236, 0.1);
}

/* Grid - Prevent shift */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

/* Flex - Prevent shift */
.flex {
    display: flex;
}

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

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

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

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

/* Spacing - Prevent shift */
.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-12 {
    margin-bottom: 3rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mt-12 {
    margin-top: 3rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

/* Padding - Prevent shift */
.p-4 {
    padding: 1rem;
}

.p-8 {
    padding: 2rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-20 {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

/* Text sizing */
.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

.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-5xl {
    font-size: 3rem;
    line-height: 1;
}

/* Animations - Prevent jank */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--bg-dark);
        color: white;
    }
}

/* Print styles */
@media print {
    nav,
    footer {
        display: none;
    }
}

/* Optimization for font loading */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

/* Reduce Cumulative Layout Shift */
h1, h2, h3 {
    contain: layout style;
}

section {
    contain: layout style paint;
}

/* Preload critical fonts */
link[rel="preload"][as="font"] {
    font-display: swap;
}
