/* SPDX-License-Identifier: MIT
 *
 * Copied from hire4real/static/css/components/autocomplete.css (MIT, same author), 2026-10-04, 180
 * lines. Colour tokens replaced per doctrine 8.
 *
 * Here it is the search box's dropdown and recent searches (SL_05D Part C).
 * Their class names, geometry, transitions and breakpoints are kept as they are; their header and
 * notes follow this one unchanged, except that a colour value a note quotes is elided as [colour]
 * (doctrine 8 reaches comments too).
 *
 * DIVERGES FROM hire4real/static/css/components/autocomplete.css: keeps Stone Lane's own markup
 *   classes .autocomplete, .autocomplete-host, .autocomplete__heading, .autocomplete__link,
 *   .autocomplete__name, .autocomplete__option, .autocomplete__ticker, .autocomplete__via -
 *   stonelane-autocomplete.js still writes these classes; they stay until the script writes
 *   theirs.
 */
/* ================================================================
 * Autocomplete dropdown for the hero search bar (NIGHT_62)
 *
 * Renders below #hero-search-input. Position is `absolute` so it
 * floats over content; the surrounding form is `relative`. Colors
 * tuned for the dark hero (bg-neutral-950).
 * ================================================================ */

/* THE CONTAINING BLOCK, guaranteed by the component that needs it.
 *
 * .autocomplete-dropdown is position:absolute with top:calc(100% + 8px), so it
 * resolves against the nearest POSITIONED ancestor. Every consumer used to
 * solve that locally -- the Compare field wraps itself in .relative, the scan
 * card in .hero__card-typeahead -- and the component simply assumed it. When
 * /layoffs became the second consumer of the shared table macro (no. 183), its
 * form was `.data-search { display: flex }` with no positioning, so the
 * dropdown resolved against the initial containing block and rendered at
 * top: 15319px in a 900px viewport: present in the DOM, correct in every
 * assertion, and 15,000 pixels below the fold on all six device/theme
 * combinations. Measured, not reasoned about.
 *
 * An element that creates an absolutely-positioned child owns the containing
 * block. This is a no-op for the two anchors that already set it.
 */
[data-autocomplete-anchor] {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);          /* slate-900-ish */
    border: 1px solid var(--line);     /* neutral-700 */
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow-float);
    max-height: 420px;
    overflow-y: auto;
    z-index: 30;
    backdrop-filter: blur(12px);
}

.autocomplete-dropdown[hidden] { display: none; }

.autocomplete-group-label {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--earth);                    /* green-400 */
    background: var(--surface);          /* green-900/18 */
    border-bottom: 1px solid var(--line);
}

.autocomplete-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    transition: background 0.12s ease;
    cursor: pointer;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item:focus,
.autocomplete-item[aria-selected="true"] {
    background: var(--surface);         /* green-500/8 */
    color: var(--ink);
    outline: none;
}

.autocomplete-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.autocomplete-meta {
    font-size: 12px;
    color: var(--ink-2);                   /* neutral-400 */
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.autocomplete-meta strong {
    color: var(--earth);                    /* green-400 */
    font-weight: 600;
}

.autocomplete-empty {
    padding: 16px;
    color: var(--ink-2);
    font-size: 14px;
    text-align: center;
}

.autocomplete-loading {
    padding: 12px 16px;
    color: var(--ink-2);
    font-size: 13px;
    text-align: center;
}

/* Match-kind badge — small chip on the right */
.autocomplete-kind {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
    letter-spacing: 0.04em;
    margin-left: auto;
}

.autocomplete-kind--alias  { background: var(--surface); color: var(--ink-2); }
.autocomplete-kind--group  { background: var(--surface); color: var(--ink-2); }
.autocomplete-kind--prefix { background: var(--surface); color: var(--earth); }
.autocomplete-kind--trigram{ background: var(--surface); color: var(--ink-2); }

/* ================================================================
 * WEDNESDAY-2 2026-09-09 (no. 183) — /layoffs is the component's second
 * consumer. Everything below is ADDITIVE and carries ZERO literal
 * colour: the attribution dot and the touch sizing inherit from the
 * row via `currentColor`, so both themes are served by the rules that
 * already style .autocomplete-item and nothing new can drift.
 * ================================================================ */

/* The attributed marker. Present only when the suggester returned a
   slug, i.e. the notice name is linked to an employer page. It is a
   MARK, not a claim: unattributed names render without it rather than
   with a "not attributed" badge nobody asked to read. */
.autocomplete-avatar {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
    vertical-align: middle;
    flex: none;
}

.autocomplete-name:has(.autocomplete-avatar) {
    display: flex;
    align-items: center;
}

/* Touch. A 12px-padded row is comfortably over 44px already, but the
   floor is asserted rather than assumed, and the dropdown goes full
   width under the input on a narrow screen instead of inheriting the
   hero's width. */
@media (max-width: 640px) {
    .autocomplete-dropdown {
        left: 0;
        right: 0;
        max-height: 60vh;
        /* .mobile-bottom-nav is position:fixed at z-index 48 and 64px tall, so
           at z-index 30 it painted OVER the last suggestions -- visible in the
           dark/mobile screenshot, invisible to every DOM assertion, which is
           the whole reason the album is looked at rather than counted. An open
           combobox is a transient surface above page chrome; it closes on Esc,
           on outside click and on pick, so the nav is never blocked for long. */
        z-index: 49;
    }

    .autocomplete-item {
        min-height: 44px;
    }
}

/* ---- Stone Lane's own markup: the rules its classes need, declared in the header above. ---- */
.autocomplete-host { position: relative; }
.autocomplete {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  width: min(34rem, 100%); max-height: 22rem; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.25rem 0;
}
.autocomplete[hidden] { display: none; }
.autocomplete__heading { padding: 0.35rem 0.85rem; color: var(--ink-2); font-size: 0.8rem; }
.autocomplete__link {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.5rem;
  min-height: 44px; padding: 0.55rem 0.85rem; color: var(--ink); text-decoration: none;
}
.autocomplete__option[aria-selected="true"] .autocomplete__link,
.autocomplete__link:hover { background: var(--surface); }
.autocomplete__ticker { font-variant-numeric: tabular-nums; }
.autocomplete__name { color: var(--ink); }
.autocomplete__via { flex-basis: 100%; color: var(--ink-2); font-size: 0.82rem; }
