/* ==========================================================================
   Header search — magnifying-glass icon button that expands into a search form.
   Native HTML <details>/<summary> toggle, no JS. Submits to WordPress core
   search via /?s=query (rendered by index.twig + sections/archive-grid.twig).
   Reuses sprite icon `search` and existing color tokens (#262262, #ff3055,
   #f0effa). Loaded globally via inc/assets.php.
   ========================================================================== */

.header__search {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-inline-start: 0.5rem;
}

/* Hide the default <details> disclosure marker across browsers */
.c-search__trigger {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: #262262;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.c-search__trigger::-webkit-details-marker { display: none; }
.c-search__trigger::marker { display: none; }

.c-search__trigger:hover,
.c-search__trigger:focus-visible {
    background-color: #f0effa;
    color: #ff3055;
}

.c-search__trigger:focus-visible {
    outline: 2px solid #ff3055;
    outline-offset: 2px;
}

.c-search__trigger .icon {
    width: 1.625rem;
    height: 1.625rem;
    /* Boost visual weight of the fill-based magnifying-glass glyph by adding
       a same-color stroke; works on the <use>'d path inside the sprite. */
    stroke: currentColor;
    stroke-width: 1.25;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* Dropdown form, anchored to the trigger */
.c-search__form {
    position: absolute;
    inset-block-start: calc(100% + 0.5rem);
    inset-inline-end: 0;
    z-index: 50;
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    min-width: 22rem;
    background-color: #fff;
    border-radius: 1.25rem;
    box-shadow: 0 0.625rem 2rem rgba(38, 34, 98, 0.15);
}

.c-search__input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(38, 34, 98, 0.2);
    border-radius: 0.5rem;
    background-color: #fff;
    color: #262262;
    font-family: "DM Sans", sans-serif;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.c-search__input::placeholder { color: rgba(38, 34, 98, 0.5); }

.c-search__input:focus-visible {
    outline: 2px solid #ff3055;
    outline-offset: 2px;
    border-color: #ff3055;
}

.c-search__btn {
    padding: 0.625rem 1.125rem;
    background-color: #262262;
    color: #fff;
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: Poppins, sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.c-search__btn:hover,
.c-search__btn:focus-visible {
    background-color: #ff3055;
}

.c-search__btn:focus-visible {
    outline: 2px solid #ff3055;
    outline-offset: 2px;
}

/* Mobile: dropdown spans the available viewport width below the header */
@media (max-width: 599px) {
    .c-search__form {
        position: fixed;
        inset-block-start: 4.5rem;
        inset-inline-start: 1rem;
        inset-inline-end: 1rem;
        min-width: 0;
        padding: 0.75rem;
        border-radius: 1rem;
    }
    .c-search__btn {
        padding-inline: 0.875rem;
    }
}

/* Visually-hidden helper (only define if the project doesn't already provide it) */
.c-search__form .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .c-search__trigger,
    .c-search__btn {
        transition: none;
    }
}
