/* =============================================================================
   === Ask READI Component ===
   =============================================================================
   Global search / ask modal opened from the "Ask READI" nav util-link.
   Markup : template-parts/ask-readi-modal.php
   JS     : assets/js/ask-readi.js
   Figma  : Y2Wxze54xrEMm3aZ05HjVC, page "Prototypes v5"
            empty 6177:51793 · ask 6177:51892 · search 6180:52011
   Scope  : every rule is under .ask-readi (modal) or the nav modifier
            .site-nav__util-link--ask. No bare global selectors.
   ============================================================================= */

.ask-readi {
    --ask-black:        #2E2925;
    --ask-white:        #FFFFFF;
    --ask-neutral-300:  #DEE2E6;
    --ask-neutral-500:  #8C959D;
    --ask-neutral-600:  #6C757D;
    --ask-primary-500:  #3D6BEA;
    --ask-primary-200:  #ABBFF7;
    --ask-primary-050:  #EEF3FE;
    --ask-radius:       15px;
    --ask-radius-sm:    5px;
    --ask-pad:          24px;

    /* Layout rules (Carlos, 2026-10-02): anchored 192px from the top of the
       viewport, grows with its content, always leaves 192px at the bottom;
       the results field scrolls when the content is taller than that. */
    --ask-max-width:    954px;  /* Figma frame width, all three states */
    --ask-offset-top:   192px;
    --ask-offset-bottom:192px;

    position: fixed;
    inset: 0;
    z-index: 2000; /* above .site-nav (1000) */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--ask-offset-top) 16px var(--ask-offset-bottom);
    box-sizing: border-box;
}

.ask-readi[hidden] {
    display: none;
}

.ask-readi *,
.ask-readi *::before,
.ask-readi *::after {
    box-sizing: border-box;
}

/* ── Blurred background (Figma "blurred background") ─────────────────────── */
.ask-readi__backdrop {
    position: absolute;
    inset: 0;
    /* Carlos, 2026-10-02 (round 2): "add more blur to the background so
       there is more contrast between the site and the pop up search
       window ... bring the opacity to 90%". Blur raised 10px -> 24px.
       The 90% opacity lives on the gradient layer (::before) rather than
       on this element: opacity on the element that owns backdrop-filter
       also lets a slice of the SHARP, unblurred page bleed through, which
       is what was undercutting the blur in round 1. */
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
}

.ask-readi__backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(50% 50% at 50% 50%, rgba(255, 255, 255, 0.90) 49.51%, rgba(222, 226, 230, 0.90) 100%);
    opacity: 0.85; /* Carlos 2026-10-02: back to 85% (blur stays 24px) */
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
.ask-readi__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--ask-max-width);
    max-height: 100%; /* = viewport minus top + bottom offsets */
    background: var(--ask-white);
    border-radius: var(--ask-radius);
    box-shadow: 0 32px 64px -12px rgba(16, 24, 40, 0.2); /* Shadow/3xl */
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
    color: var(--ask-black);
}

/* ── Search box ─────────────────────────────────────────────────────────── */
.ask-readi__header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: var(--ask-pad);
    margin: 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--ask-neutral-300);
}

.ask-readi__ai-icon {
    display: flex;
    flex-shrink: 0;
    width: 23.7148px;
    height: 23.7234px;
}

.ask-readi__ai-icon img {
    display: block;
    width: 23.7148px;
    height: 23.7234px;
}

.ask-readi__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0;
    color: var(--ask-black);
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.ask-readi__input::placeholder {
    color: var(--ask-neutral-600); /* #6C757D, Carlos 2026-10-02 */
    opacity: 1;
}

/* Native search-field clear "x" would duplicate the close icon */
.ask-readi__input::-webkit-search-cancel-button,
.ask-readi__input::-webkit-search-decoration {
    -webkit-appearance: none;
    display: none;
}

.ask-readi__close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22.9871px;
    height: 24.9871px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--ask-radius-sm);
    background: transparent;
    cursor: pointer;
}

.ask-readi__close img {
    display: block;
    width: 22.9871px;
    height: 24.9871px;
}

.ask-readi__close:hover {
    background: var(--ask-neutral-300);
}

.ask-readi__close:focus-visible {
    outline: 2px solid var(--ask-primary-500);
    outline-offset: 2px;
}

/* ── Results field ──────────────────────────────────────────────────────── */
.ask-readi__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding: var(--ask-pad) var(--ask-pad) 12px;
}

/* Empty state: Figma pads the field 96px at the bottom */
.ask-readi__body[data-state="empty"] {
    padding-bottom: 96px;
}

.ask-readi__group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.ask-readi__label {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ask-neutral-500);
}

/* Answer */
.ask-readi__answer {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 24px;
    color: var(--ask-neutral-600);
}

.ask-readi__answer p {
    margin: 0 0 12px;
    font: inherit;
    color: inherit;
}

.ask-readi__answer p:last-child {
    margin-bottom: 0;
}

/* Suggested / related question chips */
.ask-readi__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ask-readi__chip {
    display: inline-flex;
    align-items: center;
    margin: 0;
    /* Figma strokes sit inside the 36px box: 2px border + 4px/10px
       padding = the 6px/12px inset shown in the design */
    padding: 4px 10px;
    border: 2px solid var(--ask-primary-200);
    border-radius: var(--ask-radius-sm);
    background: var(--ask-primary-050);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.32px;
    color: var(--ask-primary-500);
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease;
}

.ask-readi__chip:hover {
    border-color: var(--ask-primary-500);
}

.ask-readi__chip:focus-visible {
    outline: 2px solid var(--ask-primary-500);
    outline-offset: 2px;
}

/* Results list */
.ask-readi__results {
    display: flex;
    flex-direction: column;
    gap: 24px; /* Carlos 2026-10-05: back to 24px (Figma 6180:51960 shows 12px) */
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ask-readi__result {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--ask-radius-sm);
}

/* Title row: "Title | Category" (Figma 6180:51960). The title truncates
   with an ellipsis; the separator and category never shrink. */
.ask-readi__result-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 18px;
    line-height: 24px;
    white-space: nowrap;
}

.ask-readi__result-title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    letter-spacing: 0.36px;
    color: var(--ask-black);
    transition: color 150ms ease;
}

.ask-readi__result-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.ask-readi__result-sep {
    flex-shrink: 0;
    font-weight: 700;
    letter-spacing: 0.36px;
    color: var(--ask-neutral-500);
}

.ask-readi__result-category {
    flex-shrink: 0;
    font-weight: 400;
    color: var(--ask-neutral-500);
}

.ask-readi__result-preview {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    letter-spacing: 0.28px;
    color: var(--ask-neutral-600);
}

.ask-readi__result:hover .ask-readi__result-title,
.ask-readi__result:focus-visible .ask-readi__result-title {
    color: var(--ask-primary-500);
}

.ask-readi__result:focus-visible {
    outline: 2px solid var(--ask-primary-500);
    outline-offset: 4px;
}

/* Loading + no-results (not in Figma; placeholders until designed) */
.ask-readi__status {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.32px;
    color: var(--ask-neutral-600);
}

.ask-readi__skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ask-readi__skeleton span {
    display: block;
    height: 16px;
    border-radius: var(--ask-radius-sm);
    background: linear-gradient(90deg, #F1F3F5 25%, #E9ECEF 50%, #F1F3F5 75%);
    background-size: 200% 100%;
    animation: ask-readi-shimmer 1.2s linear infinite;
}

.ask-readi__skeleton span:nth-child(2) { width: 92%; }
.ask-readi__skeleton span:nth-child(3) { width: 64%; }

@keyframes ask-readi-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ── Footer hints ───────────────────────────────────────────────────────── */
.ask-readi__footer {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: var(--ask-pad);
    flex-shrink: 0;
    border-top: 1px solid var(--ask-neutral-300);
}

.ask-readi__hint {
    display: inline-flex;
    align-items: center;
}

.ask-readi__key,
.ask-readi__hint-label {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    border-radius: var(--ask-radius-sm);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.32px;
}

.ask-readi__key {
    background: var(--ask-neutral-300);
    color: var(--ask-black);
    box-shadow: none;
}

.ask-readi__hint-label {
    color: var(--ask-neutral-500);
}

/* Screen-reader-only label (scoped copy so the component never depends on
   a theme-level .screen-reader-text rule) */
.ask-readi .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Short viewports ─────────────────────────────────────────────────────── */
/* 192px + 192px leaves too little room below ~760px of height, so the
   offsets shrink there rather than squashing the results field. */
@media (max-height: 760px) and (min-width: 768px) {
    .ask-readi {
        --ask-offset-top:    96px;
        --ask-offset-bottom: 96px;
    }
}

/* ── Mobile (Figma 6208:3107 open · 6208:3478 AI results · 6208:3552 search,
      2026-10-05) ──────────────────────────────────────────────────────────
   Window sits 24px from every edge of the screen and grows down until it
   is 24px from the bottom; the results field scrolls inside it. The
   on-screen keyboard overlays the page: overlay, blur and window keep their
   full-screen size underneath it (Carlos, 2026-10-05). */
@media (max-width: 767px) {
    .ask-readi {
        --ask-offset-top:    24px;
        --ask-offset-bottom: 24px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .ask-readi__input {
        /* MOBILE/Paragraph Normal-Mobile. 14px is safe from iOS focus-zoom
           because the site viewport meta sets maximum-scale=1. */
        height: 22px;
        font-size: 14px;
        line-height: 22px;
        letter-spacing: 0.28px;
    }

    .ask-readi__body {
        gap: 24px;
    }

    .ask-readi__body[data-state="empty"] {
        padding-bottom: 12px;
    }

    .ask-readi__answer {
        font-size: 14px;
        line-height: 22px;
        letter-spacing: 0.28px;
    }

    /* MOBILE/Text field-Mobile chips: 30px tall (2px border inside) */
    .ask-readi__chip {
        padding: 4px 10px;
        font-size: 12px;
        line-height: 18px;
        letter-spacing: 0.24px;
    }

    .ask-readi__results {
        gap: 12px; /* Figma 6208:3552 */
    }

    /* "Title | Category": inline text flow so a long title wraps naturally
       and "| Category" (kept together) follows on the same line if it fits */
    .ask-readi__result-head {
        display: block;
        white-space: normal;
        font-size: 14px;
        line-height: 22px;
        letter-spacing: 0.28px;
    }

    .ask-readi__result-meta {
        display: inline-flex;
        margin-left: 2px; /* + the word space before it = ~6px */
        vertical-align: top;
    }

    .ask-readi__result-title {
        overflow: visible;
        font-weight: 600; /* MOBILE/Subtitle-Mobile */
        line-height: 20px;
        letter-spacing: 0.28px;
    }

    .ask-readi__result-sep {
        font-weight: 400;
        letter-spacing: 0.28px;
    }

    .ask-readi__result-category {
        letter-spacing: 0.28px;
    }

    .ask-readi__result-preview {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        font-size: 12px;
        line-height: 18px;
        letter-spacing: 0.24px;
    }

    /* No Esc key on touch screens: footer keeps only "↵ to search" */
    .ask-readi__hint--esc {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ask-readi__skeleton span {
        animation: none;
    }
}

/* Body scroll lock while the modal is open */
body.ask-readi-lock {
    overflow: hidden;
}

/* ── Nav trigger: "Ask READI" util-link ─────────────────────────────────── */
/* Same look and behaviour as Log In / Support (.site-nav__util-link in
   site-nav.css); only the trailing icon changes from the diagonal arrow
   to a magnifier (Figma 6180:52105, redrawn at the arrow's stroke). The
   element is a <button>, so the browser button chrome is reset here. */
.site-nav__util-link--ask {
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: inherit;
}

.site-nav__util-link--ask::after {
    /* 2026-10-02 (Carlos): "the magnifier icon looks thicker than the
       external icons from log in and support. Please match." Redrawn as a
       12x12 stroked icon at the arrow's 1.5px stroke (was Figma's 14px
       filled glyph, ~2px visual weight). Handle points bottom-left, as in
       Figma. Size, hover colour and hover nudge are inherited from
       .site-nav__util-link::after. */
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='7' cy='5' r='3.75' stroke='%236C757D' stroke-width='1.5'/%3E%3Cpath d='M4.25 7.75L1.5 10.5' stroke='%236C757D' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.site-nav__util-link--ask:hover::after,
.site-nav__util-link--ask:focus-visible::after {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='7' cy='5' r='3.75' stroke='%233D6BEA' stroke-width='1.5'/%3E%3Cpath d='M4.25 7.75L1.5 10.5' stroke='%233D6BEA' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ── Mobile nav trigger: magnifier next to the hamburger (< 1280px) ────── */
/* Carlos 2026-10-05: "add the magnify icon to the left next to the
   hamburger icon". Same 40px tap target and same two-stage colour as
   .site-nav__hamburger (site-nav.css): white over the hero, #0D0D0D once
   the nav turns solid on scroll. margin-left:auto pins it beside the
   hamburger inside the space-between .site-nav__inner row. */
.site-nav__search-mobile {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    color: #FFFFFF;
}

.site-nav--scrolled .site-nav__search-mobile {
    color: #0D0D0D;
}

.site-nav__search-mobile svg {
    display: block;
    width: 18px;
    height: 18px;
}

.site-nav__search-mobile:focus-visible {
    outline: 2px solid #3D6BEA;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Hidden while the mobile menu overlay is open */
body.site-nav-lock .site-nav__search-mobile {
    visibility: hidden;
}

@media (min-width: 1280px) {
    .site-nav__search-mobile {
        display: none;
    }
}
