@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;500;600&display=swap');

:root {
    --primary: #e67e22;
    --dark: #2c3e50;
    --light-bg: #fdfaf7;
    --text: #444;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* 1. GLOBAL FIX: Prevent Horizontal Scroll */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden; /* Safety net for any leaking elements */
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%; /* Ensure container stays within viewport */
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: var(--dark);
    word-wrap: break-word; /* Prevent long titles from breaking layout */
}

section { margin-bottom: 60px; }

h2 { 
    font-size: clamp(1.5rem, 5vw, 2rem); /* Responsive font size */
    border-bottom: 2px solid var(--primary); 
    display: inline-block; 
    margin-bottom: 30px; 
}

/* 2. MAIN GRID FIX: Switch to 1 column on tablet/mobile */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 300px; 
    gap: 40px;
}

@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr; /* Sidebar drops below main content */
    }
    
    .sidebar {
        order: 2; /* Ensures sidebar stays at the bottom */
    }
}

/* 3. LATEST SECTION FIX: Improved Grid Auto-fit */
.latest-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* Sidebar Styling */
.sidebar {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    height: fit-content;
    width: 100%; /* Ensure it doesn't overflow */
}

.recipe-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.recipe-card:hover { transform: translateY(-8px); }

.recipe-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card-content { padding: 20px; }

/* 4. HERO SECTION FIX: Use viewport units */
.hero {
    min-height: 400px;
    height: 60vh;
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('/images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    margin-bottom: 50px;
    padding: 0 20px;
}

/* 5. SEARCH BAR FIX: Handle small screens */
.search-container {
    margin: -40px auto 40px;
    max-width: 600px;
    width: 90%; /* Responsive width */
    display: flex;
    box-shadow: var(--shadow);
    border-radius: 30px;
    overflow: hidden;
    background: white;
}

.search-container input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    font-size: 1rem;
    outline: none;
    min-width: 0; /* Important: allows input to shrink */
}

.search-container button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 25px;
    cursor: pointer;
    font-weight: 600;
}

/* 6. NEWS/SEASONAL GRID FIX */
.news-seasonal-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .news-seasonal-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
    
    .hero {
        height: 300px;
    }
}

/* Image Responsive Fix */
img {
    max-width: 100%;
    height: auto;
    display: block;
}