/* ============================================================================
   Site search - ContentSearch.aspx
   Loaded by LoadPageSpecificFiles() in Amada.master.cs, the same way
   employment.css and software.css are attached.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. LOAD-BEARING BANNER RULES - DO NOT DELETE AS "COSMETIC".
   These four rules moved here out of the inline <style> block that used to sit
   in ContentSearch.aspx.
   --------------------------------------------------------------------------- */
#main_image_banner { display: block; }
#main_slider       { display: none; }

@media (min-width: 750px) {
    #main_image_banner { display: block; }
}

/* ---------------------------------------------------------------------------
   1b. COMPACT HERO.

   The old banner was uk-height-medium - a flat 300px - with .page-banner-title
   adding 60px of padding all round (50px above 750px). On a 768px-tall laptop
   viewport that pushed the search box and the first result below the fold, and
   on a phone the red title plate alone was taller than the first result card.
   The banner is orientation, not content: it should be a band, not a screen.

   Sizes are fluid rather than fixed so the hero shrinks with the viewport
   instead of stepping at breakpoints, with a clamp on both ends.
   --------------------------------------------------------------------------- */
#main_image_banner.as-hero {
    height: clamp(84px, 13vw, 168px);
    min-height: 0;
}

.as-hero-plate {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--as-red, #d53636);
    padding: clamp(8px, 1.6vw, 16px) clamp(22px, 4vw, 54px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

.as-hero-title {
    margin: 0;
    padding: 0;
    border: 0;
    color: #fff;
    line-height: 1.1;
    font-size: clamp(1.05rem, 2.4vw, 1.9rem);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* The breadcrumb sat on 20px padding plus 20px side margins, which on a phone is
   another 60px of chrome between the hero and the first thing you can act on. */
.as-hero + #breadcrumb {
    padding: 10px 20px;
    margin: 0 10px;
}

@media (min-width: 960px) {
    .as-hero + #breadcrumb { padding: 14px 20px; margin: 0 20px; }
}

/* ---------------------------------------------------------------------------
   2. Tokens
   --------------------------------------------------------------------------- */
.amada-search {
    --as-red: #d53636;
    --as-red-dark: #b02a2a;
    --as-ink: #1a1a1a;
    --as-body: #444;
    --as-muted: #6b6b6b;
    --as-rule: #e6e6e6;
    --as-tint: #f7f7f7;
    --as-radius: 4px;

    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px 60px;
    color: var(--as-body);
}

/* ---------------------------------------------------------------------------
   3. Search band
   --------------------------------------------------------------------------- */
.as-band { margin: 20px 0 18px; }

@media (max-width: 639px) {
    .as-band { margin: 14px 0 12px; }
}

.as-field {
    position: relative;
    display: flex;
    align-items: stretch;
    max-width: 780px;
    border: 1px solid #d9d9d9;
    border-radius: var(--as-radius);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.as-field:focus-within {
    border-color: var(--as-red);
    box-shadow: 0 0 0 3px rgba(213, 54, 54, .14);
}

.as-field-icon {
    align-self: center;
    padding: 0 14px 0 18px;
    color: var(--as-muted);
    font-size: 1.05rem;
}

/* asp:TextBox renders <input type="search"> */
.as-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 16px 8px;
    font-size: 1.05rem;
    font-family: inherit;
    color: var(--as-ink);
    -webkit-appearance: none;
    appearance: none;
}

.as-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.as-input::placeholder { color: #9a9a9a; }

/* asp:Button renders <input type="submit"> */
.as-submit {
    flex: 0 0 auto;
    border: 0;
    margin: 5px;
    padding: 0 30px;
    border-radius: 3px;
    background: var(--as-red);
    color: #fff;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s ease;
}

.as-submit:hover,
.as-submit:focus { background: var(--as-red-dark); }

/* ---------------------------------------------------------------------------
   4. Summary row
   --------------------------------------------------------------------------- */
.as-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--as-rule);
}

.as-count {
    margin: 0;
    font-size: 1rem;
    color: var(--as-muted);
}

.as-count strong { color: var(--as-ink); font-size: 1.15rem; }

.as-term {
    color: var(--as-ink);
    font-weight: 700;
}
.as-term::before { content: "\201C"; }
.as-term::after  { content: "\201D"; }

.as-dym,
.as-dym-big { display: block; margin-top: 6px; font-style: italic; color: var(--as-muted); }
.as-dym-big { font-size: 1.05rem; font-style: normal; margin: 4px 0 18px; }

.as-summary-sort { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.as-sort-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--as-muted);
}

.as-sort {
    font-size: .85rem;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--as-muted) !important;
    border: 1px solid transparent;
}

.as-sort:hover { color: var(--as-red) !important; }

.as-sort.is-active {
    color: var(--as-ink) !important;
    border-color: var(--as-rule);
    background: var(--as-tint);
    font-weight: 700;
}

/* ---------------------------------------------------------------------------
   5. Facet chips
   --------------------------------------------------------------------------- */
.as-facet-bar { margin: 16px 0 4px; }

.as-facets {
    display: flex;
    gap: 8px;
    /* Horizontal scroll rather than wrap on narrow screens, so the result list
       never gets pushed off the first viewport by four rows of chips. */
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.as-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--as-rule);
    border-radius: 999px;
    background: #fff;
    color: var(--as-body) !important;
    font-size: .85rem;
    line-height: 1.2;
    white-space: nowrap;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.as-chip:hover { border-color: var(--as-red); color: var(--as-red) !important; }

.as-chip.is-active {
    background: var(--as-red);
    border-color: var(--as-red);
    color: #fff !important;
    font-weight: 700;
}

.as-chip-count {
    font-size: .75rem;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--as-tint);
    color: var(--as-muted);
}

.as-chip.is-active .as-chip-count { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------------------------------------------------------------------------
   6. Results
   --------------------------------------------------------------------------- */
.as-results {
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.as-result {
    background: #fff;
    border: 1px solid var(--as-rule);
    border-radius: var(--as-radius);
    overflow: hidden;
}

.as-result-link {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 18px 22px;
    color: inherit !important;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

/* The red left rule slides in on hover - the same accent idiom already used
   elsewhere in amada.css. */
.as-result-link::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3px;
    background: var(--as-red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .15s ease;
}

.as-result-link:hover,
.as-result-link:focus-visible {
    background: #fcfcfc;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    transform: translateY(-1px);
}

.as-result-link:hover::before,
.as-result-link:focus-visible::before { transform: scaleX(1); }

.as-result.is-top { border-color: rgba(213, 54, 54, .35); }

.as-result-body { flex: 1 1 auto; min-width: 0; }

.as-eyebrow {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--as-red);
    margin-bottom: 6px;
}

.as-title {
    display: block;
    font-size: 1.2rem;
    line-height: 1.35;
    font-weight: 700;
    color: var(--as-ink);
    margin-bottom: 4px;
}

.as-result-link:hover .as-title { color: var(--as-red); }

.as-path {
    display: block;
    font-size: .78rem;
    color: var(--as-muted);
    margin-bottom: 9px;
    word-break: break-word;
}

.as-sep { color: #bbb; }

.as-snippet {
    display: block;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--as-body);
}

/* Deliberately NOT the browser default yellow. */
.as-snippet mark {
    background: rgba(213, 54, 54, .14);
    color: inherit;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

/* ---------------------------------------------------------------------------
   7. Relevance meter
   --------------------------------------------------------------------------- */
.as-result-meta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 2px;
}

.as-best {
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #fff;
    background: var(--as-red);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.as-meter { display: flex; gap: 3px; align-items: flex-end; height: 16px; }

.as-bar {
    display: block;
    width: 4px;
    background: #e2e2e2;
    border-radius: 1px;
}

.as-bar:nth-child(1) { height: 6px; }
.as-bar:nth-child(2) { height: 9px; }
.as-bar:nth-child(3) { height: 12px; }
.as-bar:nth-child(4) { height: 16px; }
.as-bar.is-on { background: var(--as-red); }

/* ---------------------------------------------------------------------------
   8. Empty / no-results state
   --------------------------------------------------------------------------- */
.as-empty {
    text-align: center;
    padding: 46px 20px 20px;
    max-width: 780px;
    margin: 0 auto;
}

.as-empty-icon { font-size: 2.6rem; color: #dcdcdc; margin-bottom: 14px; display: block; }

.as-empty h2 {
    font-size: 1.5rem;
    color: var(--as-ink);
    margin: 0 0 10px;
    border: 0;
}

.as-empty > p { color: var(--as-muted); font-size: 1rem; line-height: 1.6; }

.as-tips {
    list-style: none;
    margin: 18px auto 26px;
    padding: 18px 22px;
    max-width: 560px;
    text-align: left;
    background: var(--as-tint);
    border-radius: var(--as-radius);
}

.as-tips li { padding: 5px 0 5px 22px; position: relative; font-size: .93rem; }

.as-tips li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--as-red);
}

.as-destinations {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 26px;
    text-align: left;
}

.as-dest {
    display: block;
    padding: 18px;
    border: 1px solid var(--as-rule);
    border-radius: var(--as-radius);
    background: #fff;
    color: inherit !important;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.as-dest:hover {
    border-color: var(--as-red);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    transform: translateY(-1px);
}

.as-dest .fa { color: var(--as-red); font-size: 1.3rem; margin-bottom: 8px; display: block; }
.as-dest-title { display: block; font-weight: 700; color: var(--as-ink); margin-bottom: 3px; }
.as-dest-blurb { display: block; font-size: .84rem; color: var(--as-muted); line-height: 1.45; }

/* ---------------------------------------------------------------------------
   9. Pager
   --------------------------------------------------------------------------- */
.as-pager-bar { margin-top: 30px; }
.as-pager { margin: 0; }
.as-pager a { color: var(--as-muted) !important; }
.as-pager a:hover { color: var(--as-red) !important; }
.as-pager .uk-active span { color: var(--as-red); font-weight: 700; }

/* ---------------------------------------------------------------------------
   10. Type-ahead - shared by the header box and the on-page box.
       The wrapper is created by js/search.js.
   --------------------------------------------------------------------------- */
.as-typeahead { position: relative; }

.as-suggest {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--as-rule, #e6e6e6);
    border-radius: 4px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .14);
    text-align: left;
}

.as-suggest[hidden] { display: none; }

.as-suggest-item {
    display: block;
    padding: 9px 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    color: #1a1a1a;
}

.as-suggest-item.is-active,
.as-suggest-item:hover {
    background: #f7f7f7;
    border-left-color: #d53636;
}

.as-suggest-title { display: block; font-size: .92rem; line-height: 1.3; }

.as-suggest-section {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b6b6b;
    margin-top: 2px;
}

/* The header box sits on the dark global header, so its dropdown needs its own
   text colour rather than inheriting the header's white. */
.search-container .as-suggest,
.search-container .as-suggest-item { color: #1a1a1a; }

/* ---------------------------------------------------------------------------
   11. Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 959px) {
    /* The meter is a nicety; the "Best match" pill carries the signal that matters. */
    .as-meter { display: none; }
}

@media (max-width: 639px) {
    .amada-search { padding: 0 14px 40px; }
    .as-field { flex-wrap: nowrap; }
    /* Shrink the label rather than replacing it. asp:Button renders <input
       type="submit">, and ::before/::after DO NOT RENDER on replaced elements, so the
       font-size:0 + ::after{content:"GO"} trick leaves a blank red square on every
       phone. Caught by forcing this breakpoint on in a 375px frame. */
    .as-submit { padding: 0 15px; font-size: .78rem; letter-spacing: .02em; }
    .as-result-link { flex-direction: column; gap: 10px; padding: 16px; }
    .as-result-meta { flex-direction: row; align-items: center; }
    .as-title { font-size: 1.08rem; }
    .as-destinations { grid-template-columns: 1fr; }
    .as-summary { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------------------------
   12. Accessibility and print
   --------------------------------------------------------------------------- */

/* Reuse the site's own focus token (amada.css :root) instead of inventing one. */
.amada-search a:focus-visible,
.amada-search input:focus-visible,
.amada-search button:focus-visible {
    outline: var(--focus-style, 1px dashed #000);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .as-result-link,
    .as-result-link::before,
    .as-dest,
    .as-submit,
    .as-chip {
        transition: none !important;
    }
    .as-result-link:hover,
    .as-dest:hover { transform: none; }
}

@media print {
    .as-band,
    .as-facet-bar,
    .as-summary-sort,
    .as-pager-bar,
    .as-meter,
    .as-suggest { display: none !important; }

    .as-result { break-inside: avoid; border-color: #ccc; }
    .as-result-link { padding: 8px 0; }

    /* Printed results are useless without the address. */
    .as-path::after { content: " (" attr(data-url) ")"; }
}
