/* ── MFC Blog Search Section ─────────────────────────────────────── */

/*
 * #mfc-search-section is injected by loop_start, which lands it inside
 * the post grid container. We use a full-bleed escape technique to make
 * it span 100vw regardless of the parent grid/flex context.
 */

#mfc-search-section {
    /* Break out of any grid cell */
    grid-column: 1 / -1 !important;
    width: 100%;

    /* Full-bleed band */
    background: #f0f4fb;
    border-top: 1px solid #dce6f5;
    border-bottom: 3px solid #1a2744;

    padding: 2.5rem 1.5rem 2rem;
    margin-bottom: 2.5rem;
    box-sizing: border-box;

    /* Escape any overflow:hidden parent that might clip us */
    position: relative;
    z-index: 10;
}

/* ── Search wrap (centered, constrained) ──────────────────────────── */
#mfc-search-wrap {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
}

/* ── Label ──────────────────────────────────────────────────────────── */
#mfc-search-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #1a2744;
    opacity: 0.5;
    margin-bottom: 0.75rem;
    cursor: default;
}

#mfc-search-label svg {
    flex-shrink: 0;
}

/* ── Input row ───────────────────────────────────────────────────── */
.mfc-search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.mfc-search-icon {
    position: absolute;
    left: 1.1rem;
    color: #8a9ab5;
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.2s;
}

#mfc-search-input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3.25rem;
    font-size: 1.05rem;
    font-family: inherit;
    color: #1a2744;
    background: #fff;
    border: 2px solid #c8d6ec;
    border-radius: 12px;
    outline: none;
    box-shadow:
        0 1px 3px rgba(26, 39, 68, 0.06),
        0 4px 16px rgba(26, 39, 68, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#mfc-search-input::placeholder {
    color: #b0bdd4;
    font-style: italic;
}

#mfc-search-input:focus {
    border-color: #1a2744;
    box-shadow:
        0 0 0 4px rgba(26, 39, 68, 0.10),
        0 4px 16px rgba(26, 39, 68, 0.10);
}

#mfc-search-input:focus + .mfc-search-icon,
.mfc-search-inner:focus-within .mfc-search-icon {
    color: #1a2744;
}

/* ── Dropdown results ────────────────────────────────────────────── */
#mfc-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #c8d6ec;
    border-radius: 12px;
    box-shadow:
        0 4px 6px rgba(26, 39, 68, 0.05),
        0 16px 40px rgba(26, 39, 68, 0.16);
    z-index: 9999;
    overflow: hidden;
}

#mfc-search-results.active { display: block; }

/* Results header bar */
.mfc-results-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.55rem 1rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a9ab5;
    background: #f8fafd;
    border-bottom: 1px solid #edf2fb;
}

.mfc-results-header svg {
    flex-shrink: 0;
}

/* Individual result row */
.mfc-result-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f4fb;
    transition: background 0.12s;
}

.mfc-result-item:last-child { border-bottom: none; }

.mfc-result-item:hover,
.mfc-result-item:focus {
    background: #f2f6fd;
    outline: none;
}

.mfc-result-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a2744;
    grid-column: 1;
    line-height: 1.3;
}

/* Gold accent bar on hover */
.mfc-result-item:hover .mfc-result-title,
.mfc-result-item:focus .mfc-result-title {
    color: #c8960c;
}

.mfc-result-meta {
    font-size: 0.7rem;
    color: #b5c2d6;
    grid-column: 2;
    align-self: start;
    white-space: nowrap;
    padding-top: 2px;
}

.mfc-result-excerpt {
    font-size: 0.8rem;
    color: #5a6a87;
    line-height: 1.5;
    grid-column: 1 / -1;
}

.mfc-result-excerpt mark {
    background: #fef08a;
    color: #1a2744;
    border-radius: 2px;
    padding: 0 2px;
    font-weight: 700;
}

/* ── States: loading / no results ────────────────────────────────── */
.mfc-search-loading,
.mfc-search-none {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.25rem 1rem;
    font-size: 0.88rem;
    color: #8a9ab5;
}

.mfc-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #d1d8e8;
    border-top-color: #1a2744;
    border-radius: 50%;
    animation: mfc-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes mfc-spin {
    to { transform: rotate(360deg); }
}
