/* Layout Shift Prevention CSS - Load this first! */

/* Global box-sizing reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* HTML and Body setup */
html {
    overflow-y: scroll; /* Always show scrollbar */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Container layout shift prevention */
.container,
.container.mx-auto.px-4,
div.container.mx-auto.px-4 {
    width: 100% !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    min-height: 100vh !important;
    contain: layout style !important;
    will-change: auto !important;
    transform: translateZ(0) !important; /* Force GPU acceleration */
}

/* Header stability */
header {
    position: relative;
    min-height: 64px;
    width: 100%;
    z-index: 9999;
}

/* Main content area */
.bg-white.min-h-screen {
    min-height: 100vh !important;
}

/* Hero section */
.hero-section {
    min-height: 280px !important;
    width: 100% !important;
}

/* Category tabs */
.category-tabs {
    min-height: 44px !important;
    width: 100% !important;
}

/* Agents grid */
.agents-grid {
    /* min-height removed to adapt to content */
    width: 100% !important;
    contain: layout !important;
}

/* Section title */
.section-title,
h2.section-title {
    min-height: 32px !important;
}

/* Image stability */
img {
    max-width: 100%;
    height: auto;
    display: block;
    aspect-ratio: attr(width) / attr(height);
}

/* Agent avatars */
.agent-avatar,
.aos-icon {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* Font loading optimization */
@font-face {
    font-family: 'Roboto';
    font-display: swap;
    src: local('Roboto');
}

@font-face {
    font-family: 'Poppins';
    font-display: swap;
    src: local('Poppins');
}

/* Icon stability */
i[class*="fa-"],
.fas, .far, .fab {
    display: inline-block;
    width: 1em;
    height: 1em;
    line-height: 1;
    vertical-align: -0.125em;
}

/* Prevent FOUC */
.no-js .agents-grid {
    visibility: hidden;
}

/* Animation performance */
* {
    will-change: auto !important;
}

/* Only animate on interaction */
*:hover,
*:focus {
    will-change: transform, opacity;
}

/* Skeleton loader */
.agent-card-skeleton {
    min-height: 280px;
    background: #f5f5f5;
    border-radius: 16px;
}

/* CTA section */
.cta-section {
    min-height: 200px;
} 
