/* TOMV transcript search — styled for the LIGHT scholarly theme
   (cream #FAF8F5 bg, dark brown #2C1810 text, gold #c9a962 / #8B6914 accents).
*/

/* Search intro block — explains the new transcript search */
.tomv-landing-search-intro {
    max-width: 720px;
    margin: 0 auto 1rem;
    text-align: center;
}
.tomv-landing-search-intro h3 {
    font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
    font-size: 1.4rem;
    color: #2C1810;
    margin: 0 0 0.5rem;
    font-weight: 600;
}
.tomv-landing-search-intro p {
    color: rgba(44, 24, 16, 0.78);
    font-size: 0.97rem;
    line-height: 1.55;
    margin: 0;
}

/* Wider, centered search input on the landing page (overrides inline style) */
.tomv-landing-filters {
    justify-content: center !important;
    align-items: stretch !important;
}
.tomv-landing-search {
    max-width: 560px !important;
    width: 100%;
    box-shadow: 0 1px 3px rgba(44, 24, 16, 0.06);
}
.tomv-landing-tribe-filter {
    background: #ffffff;
    border: 1px solid #D4C5A9;
    border-radius: 8px;
    padding: 0.7rem 2rem 0.7rem 1rem;
    font-size: 0.95rem;
    color: #2C1810;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3e%3cpath fill='%238B6914' d='M3.204 5L8 10.481 12.796 5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 12px;
    min-width: 200px;
    box-shadow: 0 1px 3px rgba(44, 24, 16, 0.06);
}
.tomv-landing-tribe-filter:focus {
    outline: none;
    border-color: #8B6914;
}
@media (max-width: 600px) {
    .tomv-landing-tribe-filter { width: 100%; max-width: 720px; }
}

/* TOMV cards on key_figure / lcr_topic taxonomy pages */
.kf-tomv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.kf-tomv-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #ffffff;
    border: 1px solid #D4C5A9;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kf-tomv-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 24, 16, 0.1);
    border-color: #8B6914;
}
.kf-tomv-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #EDE4D3;
    overflow: hidden;
}
.kf-tomv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.kf-tomv-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8B6914;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}
.kf-tomv-card:hover .kf-tomv-play { transform: translate(-50%, -50%) scale(1.1); }
.kf-tomv-dur {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(44, 24, 16, 0.85);
    color: #FAF8F5;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}
.kf-tomv-body {
    padding: 0.75rem 0.85rem;
}
.kf-tomv-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2C1810;
    line-height: 1.35;
    margin-bottom: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kf-tomv-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: rgba(44, 24, 16, 0.7);
    flex-wrap: wrap;
}
.kf-tomv-tribe {
    background: rgba(201, 169, 98, 0.18);
    color: #8B6914;
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
}

/* Reset button — only visible when search/filter is active */
.tomv-landing-reset {
    background: transparent;
    border: 1px solid #D4C5A9;
    color: #8B6914;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.tomv-landing-reset:hover {
    background: #8B6914;
    border-color: #8B6914;
    color: #FAF8F5;
}
.tomv-landing-reset i { font-size: 0.85em; }

/* Single-page transcript reset button — slightly different visual to distinguish from arrows */
.tomv-transcript-reset {
    margin-left: 0.25rem;
    color: #b87333;
}
.tomv-transcript-reset:hover {
    background: #b87333;
    border-color: #b87333;
    color: #FAF8F5;
}

/* Top quotes panel */
.tomv-quote-panel {
    margin: 1.5rem auto 2rem;
    max-width: 900px;
    background: #ffffff;
    border: 1px solid #D4C5A9;
    border-radius: 8px;
    padding: 0.5rem 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    box-shadow: 0 1px 3px rgba(44, 24, 16, 0.06);
}
.tomv-quote-panel.is-open { max-height: 4000px; opacity: 1; }
.tomv-quote-panel-header {
    padding: 0.6rem 1rem;
    color: #8B6914;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    border-bottom: 1px solid rgba(212, 197, 169, 0.5);
}
.tomv-quote-card {
    display: flex;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(212, 197, 169, 0.4);
    color: #2C1810;
    text-decoration: none;
    transition: background 0.15s ease;
}
.tomv-quote-card:first-of-type { border-top: 0; }
.tomv-quote-card:hover { background: rgba(201, 169, 98, 0.08); }
.tomv-quote-card-thumb {
    flex: 0 0 96px;
    width: 96px;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    background-color: #EDE4D3;
}
.tomv-quote-card-body { flex: 1; min-width: 0; }
.tomv-quote-card-meta {
    color: #8B6914;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
}
.tomv-quote-card-text {
    color: #2C1810;
    font-size: 0.95rem;
    line-height: 1.45;
}
.tomv-quote-card-text em {
    background: rgba(201, 169, 98, 0.35);
    color: #2C1810;
    padding: 0 0.2em;
    border-radius: 2px;
    font-style: normal;
    font-weight: 600;
}
.tomv-quote-card-cta {
    flex: 0 0 auto;
    align-self: center;
    color: #8B6914;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.tomv-quote-show-more {
    display: block;
    width: 100%;
    text-align: center;
    background: transparent;
    border: 0;
    border-top: 1px solid rgba(212, 197, 169, 0.5);
    padding: 0.75rem;
    color: #8B6914;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
}
.tomv-quote-show-more:hover { background: rgba(201, 169, 98, 0.08); }

/* Card pills */
.tomv-lcard-match-pill {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #8B6914;
    color: #FAF8F5;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.tomv-lcard-pending {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(44, 24, 16, 0.7);
    color: #FAF8F5;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Per-video transcript panel (single page) */
.tomv-transcript-panel {
    background: #ffffff;
    border: 1px solid #D4C5A9;
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.92rem;
    list-style: none;
    margin: 0;
}
.tomv-transcript-search-wrap {
    margin-bottom: 0.5rem;
}
.tomv-transcript-search {
    width: 100%;
    background: #ffffff;
    border: 1px solid #D4C5A9;
    color: #2C1810;
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    font-size: 0.92rem;
    box-sizing: border-box;
}
.tomv-transcript-search::placeholder { color: rgba(44, 24, 16, 0.5); }

.tomv-transcript-search-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: rgba(44, 24, 16, 0.7);
}
.tomv-transcript-match-count {
    flex: 1;
    font-weight: 600;
    color: #8B6914;
    font-variant-numeric: tabular-nums;
}
.tomv-transcript-jump {
    width: 32px;
    height: 28px;
    border: 1px solid #D4C5A9;
    background: #ffffff;
    color: #8B6914;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tomv-transcript-jump:hover {
    background: #8B6914;
    border-color: #8B6914;
    color: #FAF8F5;
}
.tomv-transcript-jump:focus-visible {
    outline: 2px solid #c9a962;
    outline-offset: 2px;
}

mark.tomv-transcript-hit {
    background: rgba(201, 169, 98, 0.5);
    color: #2C1810;
    padding: 0 0.1em;
    border-radius: 2px;
    font-weight: 600;
}

.tomv-transcript-row.is-current-match {
    background: rgba(201, 169, 98, 0.25);
    border-left-color: #b87333;
    box-shadow: 0 0 0 1px rgba(184, 115, 51, 0.4) inset;
}
.tomv-transcript-row.is-current-match mark.tomv-transcript-hit {
    background: #ffd97a;
}
.tomv-transcript-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.55rem 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    color: #2C1810;
    border-left: 3px solid transparent;
    transition: background 0.1s ease, border-color 0.15s ease;
}
.tomv-transcript-row:hover { background: rgba(201, 169, 98, 0.12); }
.tomv-transcript-row.is-active {
    background: rgba(201, 169, 98, 0.18);
    border-left-color: #8B6914;
    font-weight: 600;
}
.tomv-transcript-row.is-faded { opacity: 0.3; }
.tomv-transcript-row-time {
    flex: 0 0 56px;
    color: #8B6914;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    padding-top: 2px;
    font-weight: 600;
}
.tomv-transcript-row-text { flex: 1; line-height: 1.5; }

/* Single-page layout */
.tomv-single-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .tomv-single-grid { grid-template-columns: 1fr; }
    .tomv-transcript-panel { max-height: 400px; }
}

/* AI-generated description block (single page) */
.tomv-ai-description {
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    background: #ffffff;
    border-left: 3px solid #c9a962;
    border-radius: 4px;
    color: #2C1810;
    font-size: 0.97rem;
    line-height: 1.55;
    font-style: italic;
    box-shadow: 0 1px 2px rgba(44, 24, 16, 0.04);
}

/* Video controls (CC + AD toggles) */
.tomv-video-controls {
    margin-top: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.tomv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2C1810;
    font-size: 0.92rem;
    cursor: pointer;
    padding: 0.45rem 0.85rem;
    border: 1px solid #D4C5A9;
    border-radius: 999px;
    background: #ffffff;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}
.tomv-toggle:hover {
    background: rgba(201, 169, 98, 0.1);
    border-color: #8B6914;
}
.tomv-toggle input {
    accent-color: #8B6914;
    margin: 0;
    cursor: pointer;
}
.tomv-toggle input:checked + span {
    color: #8B6914;
    font-weight: 600;
}
.tomv-toggle i {
    font-size: 1.1em;
    line-height: 1;
}

/* Legacy class kept for backward compatibility */
.tomv-ad-toggle {
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2C1810;
    font-size: 0.9rem;
    cursor: pointer;
}
.tomv-ad-toggle input { accent-color: #8B6914; }

/* Spinner */
.tomv-search-spinner {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(139, 105, 20, 0.25);
    border-top-color: #8B6914;
    border-radius: 50%;
    animation: tomv-spin 0.7s linear infinite;
    display: none;
}
.tomv-search-spinner.is-visible { display: block; }
@keyframes tomv-spin { to { transform: translateY(-50%) rotate(360deg); } }
