/* Search v3 EMBED (header-safe)
   - Scoped under .qe-searchv3
   - No global resets, no body/layout rules
*/

/* container sizing for header */
.qe-searchv3 {
    width: 100%;
    max-width: 640px;
    /* safe header max; tweak later */
}

.qe-searchv3 .search-wrapper {
    position: relative;
    width: 100%;
}

/* v3: icon-left + mic-right */
.qe-searchv3 .search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.qe-searchv3 .search-bar:focus-within {
    border-color: #999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* subtle listening hint (still minimal) */
.qe-searchv3 .search-bar.is-listening {
    border-color: #b9bcc2;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.10);
}

.qe-searchv3 .search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #333;
    background: transparent;
    padding: 14px 132px 14px 46px;
    /* room: left icon + right clear + info + mic */
}

.qe-searchv3 .search-input::placeholder {
    color: #999;
}

/* LEFT search icon (clickable = search) */
.qe-searchv3 .search-button {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.qe-searchv3 .search-icon {
    width: 24px;
    height: 24px;
    opacity: 0.55;
    transition: opacity 0.15s ease;
    display: block;
}

.qe-searchv3 .search-button:hover .search-icon,
.qe-searchv3 .search-button:focus .search-icon {
    opacity: 0.85;
}

/* RIGHT mic + divider */
.qe-searchv3 .search-divider {
    position: absolute;
    right: 46px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 32px;
    background: #d1d5db;
    opacity: 0.9;
    pointer-events: none;
}

.qe-searchv3 .mic-button {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.qe-searchv3 .mic-button:hover,
.qe-searchv3 .mic-button:focus {
    opacity: 0.85;
}

.qe-searchv3 .mic-button svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* listening state */
.qe-searchv3 .mic-button.is-listening {
    opacity: 0.95;
}

/*** Clear (X) button */
.qe-searchv3 .clear-button {
    position: absolute;
    right: 82px;
    /* moved left so it doesn't overlap info-button */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.qe-searchv3 .clear-button:hover,
.qe-searchv3 .clear-button:focus {
    opacity: 0.85;
}

.qe-searchv3 .clear-button svg {
    width: 18px;
    height: 18px;
    display: block;
}

.qe-searchv3 .clear-button.is-visible {
    display: flex;
}

/* inline voice status line (created by JS) */
.qe-searchv3 .qe-voice-status {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    line-height: 1.2;
    user-select: none;
    min-height: 14px;
}

.qe-searchv3 .qe-voice-status strong {
    color: #555;
    font-weight: 600;
}

/* Dropdown */
.qe-searchv3 .search-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    /* header-safe */
    overflow: hidden;
}

.qe-searchv3 .search-options.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.qe-searchv3 .search-options__list {
    max-height: 520px;
    overflow-y: auto;
}

/* Header + dividers */
.qe-searchv3 .search-options__header {
    padding: 14px 16px 10px 16px;
    background: #fff;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.qe-searchv3 .search-options.visible .search-options__header {
    opacity: 1;
    transform: translateY(0);
}

.qe-searchv3 .qe-options-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    letter-spacing: 0.01em;
}

.qe-searchv3 .qe-options-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

/* === Option A: scope links inside dropdown header === */
.qe-searchv3 .qe-scope-links {
    margin-top: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.1;
}

.qe-searchv3 .qe-scope-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    user-select: none;
    margin-right: 2px;
}

.qe-searchv3 .qe-scope-sep {
    color: #c2c7cf;
    user-select: none;
}

.qe-searchv3 .qe-scope-link {
    font-size: 12px;
    color: #6b7280;
    /* softer */
    text-decoration: none;
    padding: 0;
    /* remove “chip” padding */
    border-radius: 0;
    /* no pill */
    background: transparent;
    /* no fill */
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
    outline: none;
}

.qe-searchv3 .qe-scope-link:hover {
    color: #111827;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(17, 24, 39, 0.25);
}

.qe-searchv3 .qe-scope-link:focus,
.qe-searchv3 .qe-scope-link:focus-visible {
    color: #111827;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(17, 24, 39, 0.30);
}

.qe-searchv3 .qe-scope-link.is-active,
.qe-searchv3 .qe-scope-link[aria-current="true"] {
    color: #111827;
    font-weight: 600;
    /* active = weight, not background */
    text-decoration: none;
}

.qe-searchv3 .qe-divider {
    height: 1px;
    margin: 0 16px;
    background: #d6d9de;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    opacity: 0;
    transition: opacity 140ms ease;
}

.qe-searchv3 .search-options.visible .qe-divider {
    opacity: 1;
}

.qe-searchv3 .search-options.qe-header-hidden .search-options__header,
.qe-searchv3 .search-options.qe-header-hidden .qe-divider--header {
    display: none;
}

/* Footer shortcuts */
.qe-searchv3 .search-options__footer {
    min-height: 44px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.qe-searchv3 .qe-footer-left {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    letter-spacing: 0.02em;
    user-select: none;
    white-space: nowrap;
}

.qe-searchv3 .qe-footer-right {
    display: flex;
    align-items: center;
    max-width: 420px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.qe-searchv3 .qe-footer-right::-webkit-scrollbar {
    height: 8px;
}

.qe-searchv3 .qe-footer-right::-webkit-scrollbar-thumb {
    background: #e5e5e5;
    border-radius: 999px;
}

.qe-searchv3 .qe-footer-right::-webkit-scrollbar-track {
    background: transparent;
}

.qe-searchv3 .qe-footer-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
    flex: 0 0 auto;
}

.qe-searchv3 .qe-footer-link:hover,
.qe-searchv3 .qe-footer-link:focus {
    color: #333;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.qe-searchv3 .qe-footer-sep {
    margin: 0 10px;
    color: #bbb;
    user-select: none;
    flex: 0 0 auto;
}

/* Options rows */
.qe-searchv3 .search-option {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s ease;
    outline: none;
}

.qe-searchv3 .search-option:hover {
    background: #f8f8f8;
}

.qe-searchv3 .search-option:focus {
    background: #f2f2f2;
}

.qe-searchv3 .search-option:last-child {
    border-bottom: none;
}

.qe-searchv3 .site-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #666;
    font-size: 14px;
    flex: 0 0 20px;
}

.qe-searchv3 .site-icon img {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.qe-searchv3 .site-name {
    font-weight: 500;
    color: #444;
    margin-right: 8px;
}

.qe-searchv3 .default-option .site-name {
    font-weight: 600;
}

.qe-searchv3 .separator {
    color: #999;
    margin: 0 6px;
    transition: transform 0.12s ease;
}

.qe-searchv3 .search-option:hover .separator {
    transform: translateX(2px);
}

.qe-searchv3 .search-term {
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qe-searchv3 .default-option {
    opacity: 0.5;
}

.qe-searchv3 .default-option:hover {
    opacity: 0.7;
    background: #f5f5f5;
}

/* Empty */
.qe-searchv3 .search-option--empty {
    cursor: default;
    color: #777;
    background: #fff;
}

.qe-searchv3 .search-option--empty:hover,
.qe-searchv3 .search-option--empty:focus {
    background: #fff;
}

.qe-searchv3 .hint-inline {
    color: #888;
    font-size: 12px;
    margin-left: 8px;
    white-space: nowrap;
}

.qe-searchv3 mark.qe-hit {
    background: #eee;
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

/* Info button (no focus outline; hover only) */
.qe-searchv3 .info-button {
    position: absolute;
    right: 46px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.35;
    transition: opacity 0.15s ease;
    outline: none;
}

.qe-searchv3 .info-button:focus,
.qe-searchv3 .info-button:focus-visible {
    outline: none;
    box-shadow: none;
}

.qe-searchv3 .info-button:hover {
    opacity: 0.75;
}

.qe-searchv3 .info-button::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 32px;
    background: #d1d5db;
    opacity: 0.9;
    pointer-events: none;
}

.qe-searchv3 .info-button svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: #000;
}

/* Help popover */
.qe-searchv3 .qe-help {
    position: absolute;
    right: 12px;
    top: calc(100% + 10px);
    width: 320px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
    padding: 12px 12px 10px;
    z-index: 1300;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.qe-searchv3 .qe-help.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.qe-searchv3 .qe-help__title {
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.qe-searchv3 .qe-help__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid #f5f5f5;
}

.qe-searchv3 .qe-help__row:first-child {
    border-top: none;
}

.qe-searchv3 .qe-help__key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #666;
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 6px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.qe-searchv3 .qe-help__txt {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
}

.qe-searchv3 .qe-help__icon svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
    opacity: 0.75;
}

/* mic pulse */
.qe-searchv3 .mic-button.is-listening svg {
    animation: qe-mic-pulse 1.6s ease-in-out infinite;
    transform-origin: 50% 50%;
}

@keyframes qe-mic-pulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }

    50% {
        transform: scale(1.06);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.85;
    }
}

@media (max-width: 640px) {
    .qe-searchv3 {
        max-width: 100%;
    }

    .qe-searchv3 .search-input {
        font-size: 15px;
        padding: 12px 122px 12px 44px;
    }

    .qe-searchv3 .qe-footer-right {
        max-width: 260px;
    }

    .qe-searchv3 .clear-button {
        right: 78px;
    }
}

/* =========================================================
   Homepage hero theme (safe — only applies inside .qe-home-hero)
   ========================================================= */

.qe-home-hero {
    background: #FFF;
}

.qe-home-hero__inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 64px 24px 56px;
}

.qe-home-hero__title {
    font-size: 2rem;
    margin-bottom: 8px;
    text-align: center;
}

.qe-home-hero__subtitle {
    color: #666;
    margin-bottom: 28px;
}

/* center + wider on homepage only */
.qe-home-hero .qe-searchv3 {
    max-width: 760px;
    margin: 0 auto;
}

/* pill look only on homepage */
.qe-home-hero .qe-searchv3 .search-bar {
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* slightly adjust inner spacing only on homepage */
.qe-home-hero .qe-searchv3 .search-input {
    padding: 12px 132px 12px 46px;
}

/* quicklinks under search on homepage */
.qe-home-quicklinks {
    margin-top: 18px;
    font-size: 0.85rem;
    color: #666;
}

.qe-home-quicklinks a {
    color: inherit;
    text-decoration: none;
}

.qe-home-quicklinks a:hover {
    text-decoration: underline;
}

.qe-home-quicklinks .dot {
    margin: 0 10px;
    color: #aaa;
}

@media (max-width: 640px) {
    .qe-home-hero__inner {
        padding: 56px 16px 46px;
    }

    .qe-home-hero__title {
        font-size: 1.6rem;
    }

    .qe-home-hero .qe-searchv3 .search-bar {
        border-radius: 18px;
        padding: 6px 10px;
    }
}