/* Site-wide search (D-111) — header 🔍 button, Practice Hub search bar, one panel.
   The theme styles every bare <button> (padding 15px 50px, capitalize) and the
   Elementor kit's line-height inherits as px, so every element here resets both. */

.as-search,
.as-search-trigger,
.as-search-hubbar {
    --as-ink: #1f2933;
    --as-muted: #52606d;
    --as-line: #d9e2ec;
    --as-soft: #f5f7fa;
    --as-accent: #0f6e56;
    --as-focus: #2563eb;
    --as-radius: 14px;
    line-height: 1.35;
    font-family: inherit;
}

/* ── header door ─────────────────────────────────────────────────────── */
/* `body button.x` outranks the kit's `.elementor-kit-N button` (+ :hover/:focus). */

/* Reads as a search FIELD (wide, crisp dark edge, soft lift, green magnifier)
   so it is found at a glance; still one tap that opens the panel. */
body button.as-search-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 46px;
    min-width: 260px;
    margin: 0 12px;
    padding: 0 18px 0 14px;
    border: 2px solid #334e68;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.08);
    color: #3e4c59;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    cursor: text;
    flex: 0 0 auto;
}

body button.as-search-trigger svg {
    flex: 0 0 auto;
    color: var(--as-accent);
}

body button.as-search-trigger:hover,
body button.as-search-trigger:focus {
    border-color: var(--as-accent);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 8px 22px rgba(15, 110, 86, 0.18);
    color: #3e4c59;
}

@media (prefers-reduced-motion: no-preference) {
    body button.as-search-trigger {
        transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }
}

@media (max-width: 1100px) {
    body button.as-search-trigger {
        min-width: 180px;
    }
}

.as-search-trigger:focus-visible,
.as-search-hubbar:focus-visible,
.as-search button:focus-visible,
.as-search a:focus-visible,
.as-search__input:focus-visible {
    outline: 3px solid var(--as-focus);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    body button.as-search-trigger {
        min-width: 46px;
        margin: 0 6px;
        padding: 0;
        justify-content: center;
    }

    .as-search-trigger__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ── hub door ────────────────────────────────────────────────────────── */

/* Same width as the hub (960px), with a 16px gutter on phones. A crisp dark
   edge, a soft lift and a green "Search" end-cap so it reads as THE way in. */
body button.as-search-hubbar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(100% - 32px);
    max-width: 960px;
    min-height: 60px;
    margin: 8px auto 20px;
    padding: 6px 6px 6px 20px;
    border: 2px solid #334e68;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);
    color: #3e4c59;
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    cursor: text;
}

body button.as-search-hubbar:hover,
body button.as-search-hubbar:focus {
    border-color: var(--as-accent);
    background: #fff;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 110, 86, 0.18);
    color: #3e4c59;
}

.as-search-hubbar svg {
    flex: 0 0 auto;
    color: var(--as-accent);
}

.as-search-hubbar__go {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 10px 20px;
    border-radius: 999px;
    background: var(--as-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

@media (prefers-reduced-motion: no-preference) {
    body button.as-search-hubbar {
        transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }
}

@media (max-width: 480px) {
    body button.as-search-hubbar {
        font-size: 16px;
    }

    .as-search-hubbar__go {
        padding: 10px 14px;
    }
}

.as-search-hubbar__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── panel ───────────────────────────────────────────────────────────── */

html.as-search-open,
html.as-search-open body {
    overflow: hidden;
}

.as-search {
    position: fixed;
    inset: 0;
    /* Above every site modal (the hub welcome card, consent): search was asked for. */
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--as-ink);
    font-size: 16px;
}

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

.as-search__panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    border-radius: var(--as-radius);
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
    overflow: hidden;
}

@media (max-width: 767px) {
    .as-search {
        padding: 0;
    }

    .as-search__panel {
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}

.as-search__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--as-line);
}

.as-search__icon {
    display: inline-flex;
    color: var(--as-muted);
}

.as-search .as-search__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 0 12px;
    border: 2px solid var(--as-line);
    border-radius: 10px;
    background: #fff;
    color: var(--as-ink);
    font-size: 18px;
    line-height: 1.3;
}

.as-search .as-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.as-search .as-search__input:focus {
    border-color: var(--as-accent);
}

.as-search .as-search__clear,
.as-search .as-search__close,
.as-search .as-back,
.as-search .as-chip,
.as-search .as-subcat__name {
    margin: 0;
    font-family: inherit;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
    cursor: pointer;
}

.as-search .as-search__clear {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--as-muted);
    font-size: 20px;
}

.as-search .as-search__close {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--as-line);
    border-radius: 10px;
    background: var(--as-soft);
    color: var(--as-ink);
    font-size: 16px;
    font-weight: 600;
}

.as-search .as-search__clear:hover,
.as-search .as-search__close:hover {
    background: var(--as-line);
    color: var(--as-ink);
}

.as-search__body {
    flex: 1 1 auto;
    padding: 8px 18px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.as-search .as-search__h {
    margin: 22px 0 10px;
    padding: 0;
    color: var(--as-ink);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.as-search__loading,
.as-search__none {
    margin: 18px 0 4px;
    color: var(--as-muted);
    font-size: 17px;
}

/* chips (the browse buttons) */

.as-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.as-search .as-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--as-line);
    border-radius: 999px;
    background: var(--as-soft);
    color: var(--as-ink);
    font-size: 16px;
    font-weight: 600;
}

.as-search .as-chip:hover {
    border-color: var(--as-accent);
    background: #fff;
    color: var(--as-ink);
}

.as-search .as-chip.is-skill {
    border-color: var(--as-skill, var(--as-line));
    border-left-width: 6px;
}

/* predictive row: top matches while typing, or "Did you mean" */

.as-suggest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px 0 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ecfdf5;
}

.as-suggest__label {
    margin-right: 4px;
    color: #065f46;
    font-size: 15px;
    font-weight: 700;
}

.as-search .as-suggest .as-chip {
    background: #fff;
}

/* a picked topic */

.as-search .as-back {
    min-height: 44px;
    margin-top: 10px;
    padding: 0 6px;
    border: 0;
    background: transparent;
    color: var(--as-accent);
    font-size: 16px;
    font-weight: 600;
}

.as-search .as-back:hover {
    background: transparent;
    color: var(--as-ink);
    text-decoration: underline;
}

.as-search .as-search__facet {
    margin: 6px 0 4px;
    padding: 0;
    color: var(--as-ink);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
}

.as-search .as-search__read,
.as-search .as-subcat__read,
.as-search .as-card__guide {
    color: var(--as-accent);
    font-weight: 600;
    text-decoration: underline;
}

.as-search .as-search__read {
    display: inline-block;
    margin-bottom: 4px;
}

/* exercise cards, grouped by skill */

.as-skillgrp {
    margin-top: 14px;
}

.as-search .as-skillgrp__h {
    margin: 0 0 8px;
    padding: 0;
    color: var(--as-skill, var(--as-ink));
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.as-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .as-cards {
        grid-template-columns: 1fr 1fr;
    }
}

.as-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--as-line);
    border-left: 6px solid var(--as-skill, var(--as-accent));
    border-radius: 12px;
    background: #fff;
}

.as-search .as-card__main {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-start;
    gap: 10px;
    min-height: 56px;
    padding: 12px 14px;
    color: var(--as-ink);
    text-decoration: none;
}

.as-search .as-card__main:hover {
    background: var(--as-soft);
    color: var(--as-ink);
}

.as-card__emoji {
    font-size: 24px;
    line-height: 1;
}

.as-card__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.as-card__title {
    font-size: 17px;
    font-weight: 700;
}

.as-card__sub {
    color: var(--as-muted);
    font-size: 14px;
    font-weight: 500;
}

.as-card__plain {
    color: var(--as-muted);
    font-size: 15px;
}

.as-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 0 14px 10px 48px;
    font-size: 14px;
}

.as-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #78350f;
    font-size: 13px;
    font-weight: 700;
}

/* sub-categories under a heading (search results) */

.as-subcat {
    padding: 10px 0;
    border-top: 1px solid var(--as-line);
}

.as-subcat__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
}

.as-search .as-subcat__name {
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--as-ink);
    font-size: 17px;
    font-weight: 700;
    text-align: left;
}

.as-search .as-subcat__name:hover {
    background: transparent;
    color: var(--as-accent);
    text-decoration: underline;
}

.as-subcat__count {
    color: var(--as-muted);
    font-weight: 500;
}

.as-minis {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.as-search .as-mini {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid var(--as-line);
    border-left: 4px solid var(--as-skill, var(--as-accent));
    border-radius: 8px;
    background: #fff;
    color: var(--as-ink);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.as-search .as-mini:hover {
    background: var(--as-soft);
    color: var(--as-ink);
}

/* blog */

.as-blog {
    margin: 0;
    padding: 0 0 0 20px;
}

.as-blog li {
    margin: 6px 0;
}

.as-search .as-blog a {
    color: var(--as-accent);
    font-size: 16px;
}

@media (prefers-reduced-motion: no-preference) {
    .as-search__panel {
        animation: as-search-in 0.16s ease-out;
    }

    @keyframes as-search-in {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }
}

@media print {
    .as-search,
    .as-search-trigger,
    .as-search-hubbar {
        display: none;
    }
}
