@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%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.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 */
.card-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 */
}

/* Card Container */
.recipe-card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensures all cards in a grid stretch to same height */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f0f0f0;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}

/* Image Handling */
.card-image-wrapper {
    position: relative;
    height: 200px; /* Fixed height for the image area */
    overflow: hidden;
}

.recipe-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.recipe-card:hover img {
    transform: scale(1.05);
}


.card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ff6b35;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

/* Content Area - The "Same Size" Secret */
.card-content {
    padding: 20px;
    flex-grow: 1; /* Makes the content fill the card */
    display: flex;
    flex-direction: column;
}

.card-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: #2d3436;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Forces title to max 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3em; /* Fixed height for title area */
}


.card-description {
    font-size: 0.9rem;
    color: #636e72;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Forces description to max 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 4.2em; /* Fixed height for description area */
}

/* Make the whole card clickable without looking like a link */
.card-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.card-footer {
    margin-top: auto; /* Pushes footer to the bottom */
    padding-top: 15px;
    border-top: 1px solid #f9f9f9;
}


.read-more {
    color: #ff6b35;
    font-weight: 600;
    font-size: 0.9rem;
}


/* 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;
}



@media (max-width: 768px) {
   
    .hero {
        height: 300px;
    }
}

/* Image Responsive Fix */
img {
    max-width: 100%;
    height: auto;
    display: block;
}