/* Star Aluminium global search — isolated stylesheet, added 2026-08-20.
   Does not modify or override any existing selector on the site; every
   rule here is scoped under .sa-search-* / #sa-search-* only.

   The parent theme (Finovate) prints several fallback/Elementor CSS files
   AFTER this stylesheet (hardcoded in header output, not through
   wp_enqueue_style, so enqueue priority can't move past them) and one of
   them resets `color` on bare <button> elements to white. That made the
   search icon render white-on-white and disappear (caught 2026-08-20).
   !important below is deliberately scoped to .sa-search-* only — it never
   touches an existing selector, it just makes sure THIS isolated component
   isn't accidentally reset by CSS that loads after it. */

.sa-search-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    /* 40px on desktop to match .sa-quote's own height (40px) so the header
       row reads as one aligned line with Trade Login (38px) and Get A Quote
       — 44px made this row visibly the tallest element and threw off the
       shared baseline (GX feedback 2026-08-20). Desktop pointer targets only
       need 24x24 CSS px (WCAG 2.2 AA), so 40px is still comfortably above
       that floor; bumped back to 44px at the mobile breakpoint below where
       touch-target guidance is stricter. */
    width: 40px;
    height: 40px;
    margin-right: 8px;
    background: transparent !important;
    border: none !important;
    border-radius: 4px;
    color: #1d1d1f !important;
    cursor: pointer;
}
@media (max-width: 1200px) {
    .sa-search-trigger { width: 44px; height: 44px; }
}
.sa-search-trigger:hover,
.sa-search-trigger:focus-visible {
    background: rgba(224, 31, 39, 0.08) !important;
    color: #E01F27 !important;
}
.sa-search-trigger:focus-visible {
    outline: 2px solid #E01F27;
    outline-offset: 2px;
}
.sa-search-trigger svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor !important;
    fill: none !important;
}

.sa-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
}
.sa-search-overlay.is-open { display: block; }

.sa-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 30, 0.55);
    opacity: 0;
    transition: opacity 180ms ease;
}
.sa-search-overlay.is-open .sa-search-backdrop { opacity: 1; }

.sa-search-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0;
    transition: transform 180ms ease, opacity 180ms ease;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
.sa-search-overlay.is-open .sa-search-panel {
    transform: translateY(0);
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .sa-search-backdrop, .sa-search-panel { transition: none !important; }
}

.sa-search-panel-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px 48px;
}

.sa-search-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #e5e5ea;
    padding-bottom: 16px;
    margin-bottom: 24px;
}
.sa-search-input-row svg { width: 22px; height: 22px; color: #86868b; flex-shrink: 0; }
.sa-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: "Work Sans", sans-serif;
    font-size: 22px;
    color: #1d1d1f;
}
.sa-search-input::placeholder { color: #86868b; }
.sa-search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #86868b;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.sa-search-close:hover { background: #f2f2f4; color: #1d1d1f; }

.sa-search-section-label {
    font-family: Axiforma, sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #86868b;
    margin: 0 0 16px;
}

.sa-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.sa-search-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid #e5e5ea;
    border-radius: 6px;
    padding: 14px;
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.sa-search-card:hover,
.sa-search-card:focus-visible {
    border-color: #E01F27;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.sa-search-card-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: cover;
    background: #f2f2f4;
}
.sa-search-card-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c7c7cc;
}
.sa-search-card-img--placeholder svg { width: 24px; height: 24px; }
.sa-search-card-body {
    flex: 1;
    min-width: 0;
}
.sa-search-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: Axiforma, sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #E01F27;
    border-bottom: 2px solid #E01F27;
    padding-bottom: 2px;
    margin-bottom: 8px;
}
.sa-search-card-icon { width: 13px; height: 13px; flex-shrink: 0; }

/* Category colour language: Product stays brand red and reads first
   (GX: products should be "front and centre"); Industry/Service/Solution
   share a neutral navy so they read as substantive site pages; Blog is
   muted grey so it visibly recedes behind product/page results. */
.sa-search-card[data-category="industry"] .sa-search-card-tag,
.sa-search-card[data-category="category"] .sa-search-card-tag,
.sa-search-card[data-category="service"] .sa-search-card-tag,
.sa-search-card[data-category="solution"] .sa-search-card-tag,
.sa-search-card[data-category="page"] .sa-search-card-tag {
    color: #1c4586;
    border-bottom-color: #1c4586;
}
.sa-search-card[data-category="blog"] .sa-search-card-tag {
    color: #86868b;
    border-bottom-color: #d2d2d7;
}
.sa-search-card[data-category="blog"]:hover,
.sa-search-card[data-category="blog"]:focus-visible {
    border-color: #86868b;
}
.sa-search-card-title {
    font-family: Axiforma, sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #1d1d1f;
    margin: 0 0 6px;
}
.sa-search-card-desc {
    font-family: "Work Sans", sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #6e6e73;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sa-search-card.is-skeleton {
    pointer-events: none;
}
.sa-search-card.is-skeleton .sa-search-card-img,
.sa-search-card.is-skeleton .sa-search-card-tag,
.sa-search-card.is-skeleton .sa-search-card-title,
.sa-search-card.is-skeleton .sa-search-card-desc {
    background: linear-gradient(90deg, #f0f0f2 25%, #f7f7f8 37%, #f0f0f2 63%);
    background-size: 400% 100%;
    animation: sa-search-shimmer 1.4s ease infinite;
    color: transparent;
    border-color: transparent;
    border-radius: 3px;
}
@media (prefers-reduced-motion: reduce) {
    .sa-search-card.is-skeleton * { animation: none !important; }
}
@keyframes sa-search-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.sa-search-empty {
    padding: 32px 0;
    text-align: center;
    font-family: "Work Sans", sans-serif;
    color: #6e6e73;
}
.sa-search-empty strong { color: #1d1d1f; }

/* On mobile the header's CTA cluster (.sa-cta) is position:absolute,
   right-anchored just left of the hamburger — its width was tuned for
   exactly one child (GET A QUOTE). Adding the search trigger overflows
   that box left into the logo (caught 2026-08-20, confirmed by measuring
   .sa-search-trigger's rect landing inside .sa-logo's rect at 393px width).
   Fix: free up the ~52px the trigger+gap need by shrinking the logo
   slightly at the same breakpoints header.css already uses for it —
   scoped with :has() so it only ever applies because this feature exists;
   header.css's own .sa-logo rule is never edited. */
@media (max-width: 1200px) {
    body:has(.sa-search-trigger) .sa-logo img { height: 40px !important; }
}
@media (max-width: 480px) {
    body:has(.sa-search-trigger) .sa-logo img { height: 34px !important; }
}

/* Mobile: a capped sheet, not a full-screen takeover — it comes down to
   ~78vh and the result grid scrolls inside that; the rest of the page
   (and the close button) stays reachable instead of the view feeling
   "locked" (GX feedback 2026-08-20). */
@media (max-width: 768px) {
    .sa-search-panel {
        max-height: 78vh;
    }
    .sa-search-panel-inner {
        padding: max(16px, env(safe-area-inset-top)) 20px 24px;
    }
    .sa-search-input { font-size: 18px; }
    .sa-search-grid { grid-template-columns: 1fr; }
}
