/**
 * /mdr-content/css/public-partials/search.css — public search results page
 *
 * Page-specific stylesheet for the public /search/ page. Loaded LAST (after
 * public.css, selected via the head partial's pageCss => 'search') so it wins
 * the cascade. It reads the shared frontend tokens defined in public.css
 * (--max-w, --navy, --accent, --royal, --royal-d, --border, --muted, --card,
 * --bg …) and defines none of its own.
 *
 * Layout: the shared cap-box frame (.sx-row/-cap/-surface — white cap boxes in
 * the landing-tile geometry around the --content-surface ground, shared by both
 * search pages) wraps a two-column grid (.search-layout) — a fixed 240px facet
 * rail on the left (.facet-*: collapsible filter groups for language/subject/
 * date, a from/to date range with decade quick-links, per-facet counts and a
 * browse link) and a results column on the right. Above the results sit the
 * hit count, the sort and display-mode selectors (.results-*) and the
 * active-filter chips (.chip, .chip-clear).
 *
 * The result set renders in four display modes, each styled here: LIST (one row
 * per hit with a left thumbnail), GALLERY and GRID (tile cards / an image mosaic
 * built with CSS columns and a hover caption overlay) and SLIDESHOW (works
 * without JavaScript via the :target pseudo-class; when JS is on, .is-current
 * drives a soft cross-fade, with a thumbnail strip and a native fullscreen
 * stage). Also covered: the empty-state box (.no-results), the pager
 * (.pagination) and the standalone facet browse page (.fidx-*: responsive CSS
 * columns, an A–Z alpha jump bar and its own pager). Responsive rules collapse
 * the grid to a single column and reorder it (results first, facets below) on
 * phones.
 *
 * @package    TaNaSi-MDR
 * @author     Keylam Folker
 * @co-author  Claude (Anthropic)
 * @copyright  2026 TaNaSi
 * @license    proprietary — see RULES.md
 * @link       https://ta-na-si.eu
 * @since      1.0.0
 */

/* ── SHARED CAP-BOX FRAME: the same skeleton the content-dispatcher
      pages use — white cap boxes top/bottom in the home tiles' geometry around
      the content surface, shared by /search/ AND the facet browse page. The
      sx-* copies mirror .cpg-row/-cap/-surface in content-page.css (which
      itself mirrors home.css) — keep them in sync when the home shape changes. ── */
.sx-row { width: var(--w-page); margin: 0 auto; }
.sx-cap {
    background: var(--card);
    display: flex; align-items: center;
    color: var(--navy);
}
.sx-cap-top {
    min-height: 40px; margin-top: 20px;
    border-radius: 20% 20% 0 0;
    padding: 10px 20px 0;
    font-size: 1.05rem; font-weight: 600; line-height: 1.4;
}
.sx-cap-bottom {
    min-height: 30px; margin-bottom: 20px;
    border-radius: 0 0 20% 20%;
    padding: 0 20px;
}
.sx-surface {
    width: var(--w-page); margin: 0 auto;
    background: var(--content-surface);
}

/* .search-layout: page grid — facet rail (240px) + results column; collapses
   to one column on narrow screens (see media queries at the bottom). Inside
   the surface it only provides the inner padding; width comes from the frame. */

.search-layout {
    max-width: none; margin: 0;
    padding: 24px 20px 40px;
    display: grid; grid-template-columns: 240px 1fr; gap: 28px;
}
/* .facet-nav / .facet-box: left-rail filter groups (language, subject, date …).
   Each .facet-box is one collapsible group of clickable filter values. */
.facet-nav h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: #555; margin-bottom: 12px; }
.facet-box { margin-bottom: 22px; }
.facet-box h3 { font-size: .92rem; color: var(--navy); margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.facet-box ul { list-style: none; margin: 0; padding: 0; }
.facet-box li { margin: 0 0 4px; }
.facet-box a { color: var(--royal); text-decoration: none; font-size: .9rem; }   /* S3: filter values in the page accent */
.facet-box a:hover { text-decoration: underline; }
.facet-box li.is-active a { font-weight: 700; color: var(--navy); }
.facet-box li[dir="rtl"] { direction: rtl; text-align: right; }
.facet-date .date-row { display: flex; gap: 10px; }
.facet-date label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: 3px; flex: 1; }
.facet-date input[type="number"] { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.facet-date .date-apply { margin-top: 8px; background: var(--royal); color: #fff; border: none; border-radius: 6px; padding: 7px 16px; font-size: .82rem; font-weight: 700; cursor: pointer; }
.facet-date .date-available { margin: 8px 0 0; font-size: .76rem; color: #555; }
.facet-date .date-apply:hover { background: var(--royal-d); }
.facet-more { margin-top: 4px; }
.facet-more summary { cursor: pointer; font-size: .82rem; color: #2563eb; list-style: none; }
.facet-more summary::-webkit-details-marker { display: none; }
.facet-more summary::before { content: "▸ "; }
.facet-more[open] summary::before { content: "▾ "; }
.facet-more ul { margin-top: 4px; }

/* .results-head / .results-count / .results-controls: bar above the result set —
   hit count on the left, sort + display-mode selectors on the right. */
.results-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    justify-content: space-between; margin-bottom: 16px;
}
.results-count { color: #555; font-size: .92rem; }
.results-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.results-controls label { font-size: .82rem; color: var(--muted); }
.results-controls select {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font-size: .85rem; color: #333;
}

/* .active-chips / .chip: pills showing the currently applied filters; each chip
   carries an ".x" remove link that drops that one filter. */
.active-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef2fb; color: var(--royal-d); border: 1px solid #d6e0f5;
    padding: 4px 10px; border-radius: 14px; font-size: .82rem; text-decoration: none;
}
.chip:hover { background: #e0e8f8; }
.chip .x { font-weight: 700; }

/* .result-list / .result-item: LIST display mode — one row per hit, thumbnail on
   the left (.r-list-thumb) and title/meta/facets/description on the right. */
.result-list { list-style: none; margin: 0; padding: 0; }
.result-item {
    background: var(--card);
    border: 1px solid #e8e0cd;   /* paper-tone border on the content surface */
    border-radius: 10px; padding: 16px 18px; margin-bottom: 12px;
    display: flex; gap: 16px; align-items: flex-start;
}
.result-item .r-list-thumb {
    flex: 0 0 auto; display: block; width: 132px; line-height: 0;
}
.result-item .r-list-thumb img {
    /* Fixed width, height = true aspect ratio (never crop) — ONE
       thumbnail contract for all views; size capping happens at thumbnail
       GENERATION time, not in CSS. */
    width: 132px; height: auto;
    border-radius: 6px; background: #eef0f4; display: block;
}
.result-item .r-list-body { flex: 1 1 auto; min-width: 0; }
@media (max-width: 560px) {
    .result-item { flex-direction: column; gap: 10px; }
    .result-item .r-list-thumb, .result-item .r-list-thumb img { width: 100%; }
}
.result-item .r-title { font-size: 1.05rem; margin: 0 0 4px; }
.result-item .r-title a { color: var(--navy); text-decoration: none; }
.result-item .r-title a:hover { text-decoration: underline; }
.result-item .r-meta { font-size: .78rem; color: #5a6274; margin-bottom: 6px; }
.result-item .r-facets { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 6px; }
.result-item .r-fac { font-size: .72rem; padding: 2px 8px; border-radius: 10px; line-height: 1.5; }
.result-item .r-fac-lang { background: #eef2fb; color: var(--royal-d, #2c4a9e); }
.result-item .r-fac-subj { background: #eef6f0; color: #14613f; }
.result-item .r-badge {
    display: inline-block; background: var(--royal); color: #fff;
    padding: 1px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700;
    margin-inline-end: 8px; vertical-align: middle;
}
.result-item .r-desc { font-size: .9rem; color: #444; line-height: 1.6; }

/* Gallery/Grid display modes: .result-grid lays hits out as tiles. Gallery uses
   wider tiles (min 220px), grid uses denser tiles (min 160px). */
.result-grid { display: grid; gap: 14px; }
.view-gallery .result-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.view-grid    .result-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
/* Slideshow display mode: large stage, one item at a time, prev/next — works
   WITHOUT JavaScript via the :target pseudo-class on anchored slides. */
.slideshow { position: relative; }
/* Default (no JS): only the first slide is visible */
.slideshow .slide { display: none; }
.slideshow .slide:first-of-type { display: grid; }
/* Once ANY slide is targeted: hide the first, show the targeted one */
.slideshow:has(.slide:target) .slide:first-of-type { display: none; }
.slideshow .slide:target { display: grid; }
/* With JS: .is-current drives visibility and :target is ignored (soft cross-fade) */
.slideshow.js-on .slide { display: none !important; }
.slideshow.js-on .slide.is-current { display: grid !important; animation: slidefade .25s ease; }
@keyframes slidefade { from { opacity: 0; } to { opacity: 1; } }
.slideshow .slide { grid-template-columns: 48px 1fr 48px; align-items: center; gap: 10px; }
.slideshow .nav { display: flex; align-items: center; justify-content: center; height: 64px;
    font-size: 2rem; text-decoration: none; color: var(--royal); background: var(--bg);
    border-radius: 8px; }
.slideshow .nav:hover { background: #e7eef7; }
.slideshow .stage { text-align: center; }
.slideshow .stage img { max-height: 70vh; max-width: 100%; object-fit: contain; background: #0f1822; border-radius: 8px; }
.slideshow .caption { margin-top: 12px; }
.slideshow .caption .slide-title { display: block; font-size: 1.1rem; font-weight: 700; color: var(--navy); text-decoration: none; }
.slideshow .caption .slide-meta { color: var(--muted); font-size: .85rem; }
/* .result-card: a single tile in gallery/grid mode — thumbnail on top,
   title/meta body below. */
.result-card {
    background: var(--card);
    border: 1px solid #e8e0cd;   /* paper-tone border on the content surface */
    border-radius: 10px; overflow: hidden;
}
.result-card .r-thumb {
    /* Natural height instead of a 16:10 crop (cf. r-list-thumb). */
    width: 100%; height: auto; background: #eef0f4; display: block;
}
.result-card .r-body { padding: 10px 12px; }
.result-card .r-title { font-size: .92rem; margin: 0 0 4px; }
.result-card .r-title a { color: var(--navy); text-decoration: none; }

/* .no-results: dashed empty-state box shown when a query returns nothing. */
.no-results {
    background: var(--card); border: 1px dashed var(--border);
    border-radius: 10px; padding: 32px; text-align: center; color: var(--muted);
}

/* .pagination: page-number links at the foot of the result set (current page
   highlighted, disabled prev/next greyed out). */
.pagination {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    justify-content: center; margin-top: 24px;
}
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 8px; font-size: .85rem; text-decoration: none;
    border: 1px solid var(--border); color: #2563eb; background: #fff;   /* function links in the content pages' link blue */
}
.pagination .current { background: var(--royal); color: #fff; border-color: var(--royal); font-weight: 700; }
.pagination .disabled { color: #bbb; pointer-events: none; }

@media (max-width: 768px) {
    .search-layout { grid-template-columns: 1fr; }
}

/* ── Facet counts + browse link in the side rail ──
   f-count = archive-wide hit count from facet_counts; f-more = link to the
   browse page /search/index/<axis>/ (replaces the old full <details> render). */
.facet-box .f-count { color: #5a6274; font-size: .78rem; margin-inline-start: 6px; }
.facet-box .f-more { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 6px; }
.facet-box .f-more a { font-size: .8rem; font-weight: 700; text-decoration: none; color: #2563eb; }

/* ── Facet browse page /search/index/<axis>/ (search-index.view.php) ── (fidx-*)
   Single column; value list flows into responsive CSS columns (3/2/1).
   Includes an A–Z alpha jump bar (.fidx-alpha) and a pager. */
/* Inside the surface the wrap only provides the inner padding (shared cap-box frame). */
.fidx-wrap { max-width: none; margin: 0; padding: 24px 20px 40px; }
/* Text colours: values dark navy, semi-bold,
   hover turns royal; side texts lifted off the weak #777 for the paper ground
   (meta/range #444, counts #5a6274); toggle/back links in the content pages' link
   blue #2563eb (same raw value as the cpg-toc links in content-page.css). */
.fidx-back a { text-decoration: none; color: #2563eb; }
.fidx-back a:hover { text-decoration: underline; }
.fidx-meta { color: #444; margin: .2em 0 1em; }
.fidx-meta a { color: #2563eb; }
.fidx-range { color: #444; font-size: .85rem; margin-bottom: 6px; }
.fidx-list { columns: 3; column-gap: 2rem; list-style: none; padding: 0; margin: 0 0 18px; }
.fidx-list li { break-inside: avoid; padding: 3px 0; }
.fidx-list li.is-active a { font-weight: 700; }
.fidx-list a { text-decoration: none; color: var(--navy); font-weight: 600; }
.fidx-list a:hover { color: var(--royal); text-decoration: underline; }
.fidx-list .ix-count { color: #5a6274; font-size: .78rem; margin-inline-start: 6px; }
.fidx-alpha { margin: 0 0 12px; }
.fidx-alpha a, .fidx-alpha span { display: inline-block; padding: 2px 7px; margin-block: 0 4px; margin-inline: 0 2px;
    border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; text-decoration: none; }
.fidx-alpha a { color: var(--navy); }   /* F4: clickable letters in the value colour */
.fidx-alpha span.off { color: #b9bfcc; }
.fidx-alpha a.sel { background: var(--royal); color: #fff; border-color: var(--royal); }
.fidx-pager { border-top: 1px solid var(--border); padding-top: 10px; }
.fidx-pager .off { color: #b9bfcc; }
@media (max-width: 992px) { .fidx-list { columns: 2; } }
@media (max-width: 700px) { .fidx-list { columns: 1; } }

/* ── Hit info, clear-all, decade links, mobile order ── */
/* Real file format + duration behind the form badge; contributor line. */
.r-tech { color: var(--muted); font-size: .78rem; margin-block: 0; margin-inline: 2px 8px; }
.r-contrib { margin: 2px 0 0; font-size: .82rem; color: #5a6274; }
/* "Clear all filters" chip (only shown from 2 active filters, see partial). */
.chip-clear { background: #fbeeee; border-color: #e8c8c8; color: #a33; }
/* Decade quick-links above the from/to date box. */
.date-quick { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.date-quick a { font-size: .75rem; border: 1px solid var(--border); border-radius: 10px;
    padding: 1px 8px; text-decoration: none; background: #fff; }
.date-quick a.is-active { background: var(--royal); color: #fff; border-color: var(--royal); }
/* Mobile — results FIRST, facets below (order swap). */
@media (max-width: 768px) {
    .search-layout { display: flex; flex-direction: column; }
    /* Mobile (like the curation search view): results ON TOP,
       and below them the facet groups SIDE BY SIDE with wrapping instead of one
       long single column. */
    .search-layout .facet-nav { order: 2; display: flex; flex-wrap: wrap; gap: 0 26px; align-items: flex-start; }
    .search-layout .facet-nav h2 { flex-basis: 100%; }
    .search-layout .facet-box { flex: 1 1 150px; min-width: 140px; max-width: 240px; }
    .search-layout .results { order: 1; }
}

/* ── Grid mosaic, slideshow strip + fullscreen ──
   Grid = image mosaic (CSS columns, natural heights); title/date
   appear as an overlay only on hover/focus. Gallery keeps its plain cards. */
.view-grid .result-grid { display: block; columns: 5 160px; column-gap: 14px; }
.view-grid .result-card {
    break-inside: avoid; margin: 0 0 14px; position: relative;
    border: none; background: none; overflow: hidden; border-radius: 8px;
}
.view-grid .result-card .r-thumb { border-radius: 8px; }
.view-grid .result-card .r-body {
    position: absolute; inset-inline: 0; bottom: 0; padding: 26px 10px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    opacity: 0; transition: opacity .15s;
}
.view-grid .result-card:hover .r-body,
.view-grid .result-card:focus-within .r-body { opacity: 1; }
.view-grid .result-card .r-title a { color: #fff; }
.view-grid .result-card .r-meta { color: #d8dce6; margin: 0; }

/* Slideshow: thumbnail strip (anchor links, JS marks the active one) + fullscreen
   button. Dark stage chrome (.ss-*) overrides the neutral defaults above. */
.slideshow { background: #101319; border-radius: 12px; padding: 14px; }
.slideshow .nav { background: #1c2230; color: #cfd6e4; }
.slideshow .nav:hover { background: #2a3245; }
.slideshow .caption .slide-title { color: #fff; }
.ss-fullscreen {
    position: absolute; top: 22px; inset-inline-end: 22px; z-index: 5;
    background: rgba(16, 19, 25, .75); color: #fff; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px;
    padding: 6px 12px; font-size: .9rem;
}
.ss-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; }
.ss-thumb {
    flex: 0 0 auto; width: 72px; height: 72px; border-radius: 6px; overflow: hidden;
    border: 2px solid transparent; background: #1c2230;
}
.ss-thumb.act { border-color: #7aa2ff; }
.ss-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fullscreen mode: the stage fills the screen, the thumbnail strip stays visible below. */
.slideshow:fullscreen { display: flex; flex-direction: column; justify-content: center; }
.slideshow:fullscreen .stage img { max-height: 78vh; }
