/* Critical CSS for Recipe Page - LCP and CLS Optimization */

/* CLS Prevention - Body and Container */
body {
    margin: 0 !important;
    padding-top: 100px !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* LCP Element - Recipe Featured Image */
.recipe-img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    max-width: 100%;
    display: block;
    background-color: #f8f9fa;
    object-fit: cover;
    content-visibility: auto;
}

/* CLS Prevention - Recipe Details Grid */
.row.text-center.mb-3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    min-height: 80px;
    margin-bottom: 1rem;
}

.row.text-center.mb-3 .col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Ingredients List */
.ingredients {
    list-style: none;
    padding: 0;
}

.ingredient-check {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

/* Related Recipes - CLS Prevention */
.crop {
    width: 100%;
    height: 0;
    padding-bottom: 68.75%; /* 220/320 aspect ratio */
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

.crop img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video Container - CLS Prevention */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding-top: 90px !important;
    }
    
    .recipe-img {
        aspect-ratio: 16 / 9;
        min-height: 250px;
    }
    
    .row.text-center.mb-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        font-size: 0.9rem;
    }
    
    .container {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    h3 {
        font-size: 1.25rem;
        margin-top: 1.5rem;
    }
    
    /* Optimize related recipes grid */
    .crop {
        padding-bottom: 75%; /* More square on mobile */
    }
}

/* Prevent Font Shifts */
@font-face {
    font-family: 'Segoe UI';
    font-display: swap;
}

/* Image Loading States */
img {
    content-visibility: auto;
}

img[loading="lazy"] {
    min-height: 200px;
    background-color: #f8f9fa;
}

/* Prevent Layout Shift for Buttons */
.btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Share Buttons */
.btn-outline-primary,
.btn-outline-info,
.btn-outline-danger {
    margin-bottom: 0.5rem;
}

/* Sidebar - CLS Prevention */
.col-lg-4 {
    min-height: 400px;
}

/* Search Widget */
.widget.search-form {
    min-height: 100px;
    background-color: #f8f9fa;
}

/* Performance: Reduce Paint Area */
.card {
    contain: layout style paint;
}

/* Optimize Text Rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Reduce Repaints */
.position-relative {
    contain: layout;
}

/* Critical Path Optimization */
.above-fold {
    content-visibility: visible;
}

.below-fold {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

