/* ── Highlight Marks ──────────────────────────────────────── */

.search-hl {
    background-color: var(--search-hl-color, hsla(38, 80%, 60%, 0.3));
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    transition: background-color 0.2s ease;
}

.search-hl--active {
    background-color: var(--search-hl-active-color, hsla(38, 85%, 50%, 0.55));
    outline: 2px solid var(--search-hl-active-outline, hsl(38, 85%, 50%));
    outline-offset: 1px;
}

/* ── Search Badge (sticky bar at top of content) ─────────── */

.search-hl-badge {
    position: sticky;
    top: var(--fb-nav-height, 60px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--fb-bg-surface, #fff);
    border: 1px solid var(--fb-border, rgba(0, 0, 0, 0.1));
    border-radius: var(--fb-radius-md, 0.375rem);
    box-shadow: var(--fb-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
    font-size: var(--fb-text-sm, 0.875rem);
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.search-hl-badge--visible {
    opacity: 1;
    transform: translateY(0);
}

.search-hl-badge__count {
    color: var(--fb-text, inherit);
    white-space: nowrap;
    font-weight: 500;
}

.search-hl-badge__sep {
    width: 1px;
    height: 1rem;
    background: var(--fb-border, rgba(0, 0, 0, 0.1));
}

.search-hl-badge__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--fb-text-muted, #6b7280);
    border-radius: var(--fb-radius-sm, 0.25rem);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-hl-badge__btn:hover {
    background: var(--fb-hover, rgba(0, 0, 0, 0.05));
    color: var(--fb-text, inherit);
}

.search-hl-badge__btn:active {
    background: var(--fb-hover, rgba(0, 0, 0, 0.08));
}

.search-hl-badge__btn--dismiss {
    margin-left: 0.125rem;
}

.search-hl-badge__btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .search-hl-badge {
        gap: 0.375rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }
}

/* ── Print ───────────────────────────────────────────────── */

@media print {
    .search-hl-badge {
        display: none !important;
    }
    .search-hl {
        background: none !important;
        outline: none !important;
    }
}

/* ── Reduced Motion ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .search-hl-badge,
    .search-hl {
        transition: none;
    }
}
