/* --- 404 Page Styling (Responsive) --- */

.mi-404-wrapper {
    background-color: #fff; /* Light background */
    min-height: 80vh; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem; /* Added padding for smaller screens */
    text-align: center;
}

.mi-404-container {
    max-width: 38rem; /* max-w-xl */
    width: 100%;
    padding: 3rem; /* Reduced padding slightly for mobile */
    background-color: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e7e5e4;
}

.mi-404-error-code-standalone {
    font-size: 3rem; /* Large standalone code */
    font-weight: 900;
    color: #a8a29e; /* Light grey/stone */
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.mi-404-title {
    font-size: 2rem; /* Adjusted for mobile */
    font-weight: 800;
    color: #44403c;
    margin-top: 0;
    margin-bottom: 1rem;
}

.mi-404-description {
    font-size: 1rem; /* Adjusted for mobile */
    color: #78716c;
    margin-bottom: 1.5rem; /* Adjusted spacing */
}

/* --- Action Buttons (Responsive) --- */
.mi-404-actions {
    display: flex;
    flex-direction: column; /* Stack buttons vertically on mobile */
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mi-404-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    width: 100%; /* Full width on mobile */
    box-sizing: border-box;
}

.mi-404-btn-primary {
    background-color: #d97706; 
    color: #fff;
}

.mi-404-btn-primary:hover {
    background-color: #b45309; 
}

.mi-404-btn-secondary {
    background-color: #fff;
    color: #57534e;
    border-color: #e7e5e4;
}

.mi-404-btn-secondary:hover {
    background-color: #f5f5f4;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* --- Search Form Section --- */

.mi-404-help-section {
    padding-top: 1.5rem;
    border-top: 1px solid #e7e5e4;
}

.mi-404-help-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #78716c;
    margin-bottom: 1rem;
}

.mi-404-search-form {
    display: flex;
    border: 2px solid #d97706;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 16.8rem;
    margin: 0 auto;
}

.mi-404-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #44403c;
}

.mi-404-search-button {
    background-color: #d97706;
    border: none;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.mi-404-search-button:hover {
    background-color: #b45309;
}

.mi-404-search-button svg {
    color: #fff;
    width: 1.125rem;
    height: 1.125rem;
}

/* --- Media Queries (Tablet and Desktop Adjustments) --- */

@media (min-width: 640px) {
    .mi-404-container {
        padding: 3rem;
    }
    
    .mi-404-main-icon {
        width: 6rem;
        height: 6rem;
        stroke-width: 1.25;
    }
    
    .mi-404-error-code-standalone {
        font-size: 4rem;
    }

    .mi-404-title {
        font-size: 2.5rem;
    }

    .mi-404-description {
        font-size: 1.125rem;
    }

    /* Side-by-side buttons on larger screens */
    .mi-404-actions {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .mi-404-btn {
        width: auto; /* Reset width for inline layout */
        min-width: 120px;
    }
}

/* --- Search Results Page Styling --- */

.mi-search-wrapper {
    background-color: #fff;
    min-height: 80vh;
    padding: 2rem 0;
}

.mi-search-content-container {
    max-width: 68rem; /* Wider container for search grid */
    margin: 0 auto;
}

.mi-search-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e7e5e4;
}

.mi-search-title {
    font-size: 2rem;
    font-weight: 700;
    color: #44403c;
    margin-bottom: 0.5rem;
}

.mi-search-subtitle {
    font-size: 1.125rem;
    color: #57534e;
    margin-bottom: 0.5rem;
}

.mi-search-term {
    font-weight: 600;
    color: #d97706; /* Highlight search term */
}

.mi-search-count {
    font-size: 0.875rem;
    color: #78716c;
}

/* --- Results Grid (Responsive) --- */

.mi-search-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .mi-search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .mi-search-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Search Card Style (Compact Post Card) --- */

.mi-search-card {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
}

.mi-search-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.mi-search-image-wrap {
    position: relative;
    height: 10rem; /* Fixed height for image area */
    overflow: hidden;
}

.mi-search-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s;
}

.mi-search-card:hover .mi-search-image {
    transform: scale(1.05);
}

.mi-search-category-tag {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background-color: #d97706;
    color: #fff;
    font-size: 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
    z-index: 2;
}

.mi-search-content-area {
    padding: 1rem;
    flex-grow: 1;
}

.mi-search-card-title {
    color: #44403c;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    transition: color 0.2s;
}

.mi-search-card:hover .mi-search-card-title {
    color: #b45309;
}

.mi-search-card-excerpt {
    color: #78716c;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    /* Limit excerpt to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mi-search-meta {
    display: flex;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f5f5f4;
}

.mi-search-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: #a8a29e;
}

.mi-search-meta-item svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* --- Pagination Styling --- */

.mi-pagination {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.mi-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.8rem;
    margin: 0 0.25rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: #78716c;
    border: 1px solid #e7e5e4;
    transition: background-color 0.2s, border-color 0.2s;
}

.mi-pagination .page-numbers:hover {
    background-color: #f5f5f4;
    color: #44403c;
    border-color: #d6d3d1;
}

.mi-pagination .current {
    background-color: #d97706;
    color: #fff;
    border-color: #d97706;
}

.mi-pagination .current:hover {
    background-color: #b45309;
    color: #fff;
    border-color: #b45309;
}


/* --- No Results Styling --- */

.mi-search-no-results {
    text-align: center;
    padding: 4rem 1rem;
    background-color: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e7e5e4;
}

.mi-search-no-results-icon {
    margin-bottom: 1rem;
}

.mi-search-no-results-icon svg {
    color: #a8a29e;
    width: 3rem;
    height: 3rem;
}

.mi-search-no-results-title {
    font-size: 1.5rem;
    color: #44403c;
    margin-bottom: 0.5rem;
}

.mi-search-no-results-description {
    max-width: 30rem;
    margin: 0 auto 1.5rem auto;
    color: #78716c;
}

.mi-search-form-inline {
    display: flex;
    max-width: 24rem;
    margin: 0 auto;
    border: 2px solid #d97706;
    border-radius: 0.5rem;
    overflow: hidden;
}

.mi-search-input-lg {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #44403c;
}

.mi-search-button-lg {
    background-color: #d97706;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mi-search-button-lg:hover {
    background-color: #b45309;
}

@media (max-width: 768px) {
    .mi-search-title {
        font-size: 1.5rem;
    }
    .mi-search-subtitle {
        font-size: 1rem;
    }
    .mi-search-card-title {
        font-size: 1.125rem;
    }
}

.screen-reader-text {
    display: none;
}