/* Explain: Styles for header search box and search results page UI. */
/* ---------- Header search box ---------- */
.header-search {
    align-items: center;
    gap: 0.4rem;
    padding-block: 0.25rem;
    padding-inline: 0.75rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--surface-color);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.header-search:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}

.header-search > i {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-search input {
    width: 8.5rem;
    min-height: 2rem;
    border: 0;
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.5;
    outline: none;
}

.header-search input::placeholder {
    color: #9aa6b5;
}

.header-search button[type="submit"] {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border: 0;
    border-radius: 9999px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.25s ease;
}

.header-search button[type="submit"]:hover {
    background: var(--primary-hover);
}

.header-search--full {
    padding-inline: 0.9rem 0.35rem;
}

.header-search--full input {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

/* ---------- Search page ---------- */
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.search-input-wrap {
    display: flex;
    flex: 1 1 16rem;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    min-height: 3rem;
    padding-inline: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--surface-color);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-input-wrap:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}

.search-input-wrap > i {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.6rem;
    border: 0;
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
}

.search-input::placeholder {
    color: #9aa6b5;
}

/* ---------- Result cards ---------- */
.search-result {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.search-result:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-card);
}

.search-result-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.chip--navy {
    background: var(--primary-color);
    color: #ffffff;
}

.search-result-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.6;
    color: var(--primary-color);
    overflow-wrap: anywhere;
}

.search-result-desc {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.9;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.search-result-meta,
.search-result-field {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.7;
    color: var(--accent-hover);
}

.search-result-link {
    align-self: flex-start;
    margin-top: auto;
}

.search-empty {
    grid-column: 1 / -1;
    padding: 2rem 1rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    text-align: center;
}

.search-empty > i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.search-empty-title {
    margin: 0.6rem 0 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.7;
    color: var(--primary-color);
    overflow-wrap: anywhere;
}

.search-empty-hint {
    max-width: 34rem;
    margin: 0.4rem auto 0;
    font-size: 0.85rem;
    line-height: 1.9;
    color: var(--text-muted);
}

.search-empty-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.chip--outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.search-mark {
    padding: 0 0.15em;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--primary-color);
    font-weight: 800;
}

.search-clear {
    display: none;
    place-items: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    border-radius: 9999px;
    background: var(--accent-soft);
    color: var(--primary-color);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.search-clear.is-visible {
    display: grid;
}

.search-clear:hover {
    background: var(--primary-color);
    color: #ffffff;
}

/* Highlight the card a search result opens */
article[id]:target {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
    scroll-margin-top: 6rem;
}