/* ==========================================================================
   Search styles — header typeahead + full results page
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared: tag chips
   -------------------------------------------------------------------------- */

.tv-search-tag-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
}

.tv-search-tag-chip {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #444;
    background: #f3f3f3;
    border: 1px solid #e2e2e2;
    border-radius: 999px;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Header typeahead — NYT-inspired preview cards
   -------------------------------------------------------------------------- */

.tv-search-preview-item > .tv-search-preview-inner {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.tv-search-preview-item:last-of-type > .tv-search-preview-inner,
.tv-search-view-more > div {
    border-bottom: none;
}

.tv-search-kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 4px;
}

.tv-search-preview-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.25;
    margin-bottom: 4px;
}

.tv-search-preview-title i,
.tv-search-preview-title em {
    font-style: italic;
}

.tv-search-preview-meta {
    display: block;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 4px;
}

.tv-search-preview-excerpt {
    display: block;
    font-size: 0.85rem;
    color: #444;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-search-preview-item .tv-search-tag-list {
    margin-top: 8px;
}

.tv-search-view-more {
    font-weight: 700;
    text-align: center;
}

.tv-search-view-more > div {
    padding: 12px 16px;
}

.search-result.tv-search-preview-item:hover > .tv-search-preview-inner,
.search-result.tv-search-view-more:hover > div {
    background: rgba(0, 0, 0, 0.05);
    color: var(--link-color);
}

/* --------------------------------------------------------------------------
   Full-page search results
   -------------------------------------------------------------------------- */

.tv-search-page {
    margin-top: 2rem;
    margin-bottom: 4rem;
}

.tv-search-page-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1.25rem;
    margin-bottom: 3.5rem; /* breathing room between sort and results */
}

.tv-search-page-query {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
    line-height: 1.15;
    word-break: break-word;
}

.tv-search-page-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.95rem;
    color: #555;
    font-weight: 600;
}

.tv-search-page-count {
    text-transform: none;
    color: #222;
}

.tv-search-meta-sep {
    color: #999;
    margin: 0 0.25rem;
}

/* Modern dropdown (uses native <details>) */

.tv-search-sort {
    position: relative;
    font-weight: 600;
}

.tv-search-sort > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    background: #fff;
    color: #222;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.tv-search-sort > summary::-webkit-details-marker {
    display: none;
}

.tv-search-sort > summary:hover,
.tv-search-sort[open] > summary {
    background: #f6f6f6;
    border-color: #b8b8b8;
}

.tv-search-sort > summary:focus-visible {
    outline: 2px solid var(--active-link, #404040);
    outline-offset: 2px;
}

.tv-search-sort-caret {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.tv-search-sort[open] .tv-search-sort-caret {
    transform: rotate(180deg);
}

.tv-search-sort-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    z-index: 1100;
}

.tv-search-sort-item > a {
    display: block;
    padding: 10px 14px;
    color: #222;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
}

.tv-search-sort-item > a:hover,
.tv-search-sort-item > a:focus-visible {
    background: #f3f3f3;
    color: #000;
    outline: none;
}

.tv-search-sort-item.is-active > a {
    font-weight: 700;
    color: #000;
}

.tv-search-sort-item.is-active > a::after {
    content: '\f00c'; /* fa-check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    float: right;
    font-size: 0.8rem;
    margin-left: 12px;
    color: #555;
}

/* Result row */

.tv-search-results-list {
    margin-top: 0;
}

.tv-search-result-row {
    display: flex;
    gap: 1.75rem;
    padding: 1.75rem 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}

.tv-search-result-row:hover {
    color: var(--link-color);
}

.tv-search-result-row:hover .tv-search-result-title {
    text-decoration: underline;
}

.tv-search-result-body {
    flex: 1;
    min-width: 0;
}

.tv-search-result-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5rem;
    display: block;
}

.tv-search-result-title i,
.tv-search-result-title em {
    font-style: italic;
}

.tv-search-result-excerpt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    margin: 0 0 0.75rem;
}

.tv-search-result-byline {
    font-size: 0.85rem;
    color: #555;
    margin: 0;
}

.tv-search-result-byline strong {
    font-weight: 700;
}

.tv-search-byline-sep {
    margin: 0 0.4rem;
    color: #999;
}

.tv-search-result-date {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.tv-search-result-thumb {
    flex: 0 0 160px;
    width: 160px;
    height: 108px;
    object-fit: cover;
    object-position: center;
    background-color: #eee;
    border: 1px solid #eee;
    border-radius: 4px;
    display: block;
}

/* Pagination */

.tv-search-pagination {
    margin-top: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tv-search-pagination a,
.tv-search-pagination span {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
}

.tv-search-pagination a:hover {
    text-decoration: underline;
}

.tv-search-pagination-current {
    color: #555;
    font-weight: 600;
}

.tv-search-pagination .is-disabled {
    color: #bbb;
    cursor: default;
}

.tv-search-empty {
    padding: 3rem 0;
    text-align: center;
    color: #555;
    font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    .tv-search-page-query {
        font-size: 1.75rem;
    }

    .tv-search-result-row {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .tv-search-result-thumb {
        width: 100%;
        max-width: 100%;
        flex: none;
        height: 200px;
    }

    .tv-search-page-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .tv-search-sort-menu {
        right: auto;
        left: 0;
    }
}
