/*
 * DO NOT EDIT THIS FILE.
 * See the following change record for more information,
 * https://www.drupal.org/node/3084859
 * @preserve
 */

/**
 * @file
 * Header Search Narrow Block.
 */

.block-search-narrow {
  margin-inline: calc(-1 * var(--sp));
  margin-block-end: var(--sp2);
  background: var(--color--black);

  & .search-block-form {
    display: flex;
  }

  & .form-item {
    flex-grow: 1;
    margin: 0;
  }

  & .form-actions {
    margin: 0;
  }

  & input[type="search"] {
    width: calc(100% + var(--sp2));
    height: var(--sp3);
    padding-block: 0;
    padding-inline-start: var(--sp);
    padding-inline-end: var(--sp);
    transition: background-size 0.4s;
    color: var(--color--white);
    border: solid 1px transparent;
    background-color: transparent;
    background-image: linear-gradient(var(--color--primary-50));
    background-repeat: no-repeat;
    background-position: bottom left; /* LTR */
    background-size: 0% 0.3125rem;
    box-shadow: none;
    font-family: var(--font-serif);
    font-size: 1rem;
    -webkit-appearance: none;

    &:focus {
      outline: solid 4px transparent;
      outline-offset: -4px;
      background-size: 100% 0.3125rem;
    }

    @media (min-width: 43.75rem) {
      height: var(--sp4);
      padding-inline-start: var(--sp2);
      padding-inline-end: var(--sp2);
    }
  }

  & .search-form__submit {
    position: relative;
    overflow: hidden;
    align-self: stretch;
    width: var(--sp3);
    height: auto;
    margin-block: 0;
    margin-inline-start: 0;
    margin-inline-end: 0;
    padding-block: 0;
    padding-inline-start: 0;
    padding-inline-end: 0;
    cursor: pointer;
    border-color: transparent;
    background-color: transparent;

    /*
      When in Windows high contrast mode, FF will not output either background
      images or SVGs that are nested directly within a <button> element, so we add a <span>.
    */
    & .icon--search {
      position: absolute;
      inset-block-start: 0;
      inset-inline-start: 0;
      display: block;
      width: 100%; /* Width of the SVG background image. */
      height: 100%;
      pointer-events: none;
      background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='26' height='27.2' viewBox='0 0 26 27.2'%3e  %3cpath fill='%23fff' d='M25.8,25.5l-5.3-5.3c2.1-2.1,3.4-5.1,3.4-8.3C23.9,5.3,18.5,0,11.9,0C5.3,0,0,5.3,0,11.9c0,6.6,5.3,11.9,11.9,11.9c2.6,0,5.1-0.9,7-2.3l5.4,5.4c0.4,0.4,1,0.4,1.4,0C26.1,26.6,26.1,25.9,25.8,25.5z M11.9,21.9c-5.5,0-9.9-4.4-9.9-9.9S6.4,2,11.9,2c5.5,0,9.9,4.4,9.9,9.9S17.4,21.9,11.9,21.9z'/%3e%3c/svg%3e");
      background-repeat: no-repeat;
      background-position: center;
      background-size: auto;

      &::after {
        position: absolute;
        inset-block-end: 0;
        inset-inline-start: 0;
        width: 100%;
        height: 0;
        content: "";
        transition: transform 0.2s;
        transform: scaleX(0);
        transform-origin: left; /* LTR */
        border-block-start: solid 0.3125rem var(--color--primary-50);
      }

      @media (forced-colors: active) {
        background: buttontext;
        mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='26' height='27.2' viewBox='0 0 26 27.2'%3e  %3cpath fill='%23fff' d='M25.8,25.5l-5.3-5.3c2.1-2.1,3.4-5.1,3.4-8.3C23.9,5.3,18.5,0,11.9,0C5.3,0,0,5.3,0,11.9c0,6.6,5.3,11.9,11.9,11.9c2.6,0,5.1-0.9,7-2.3l5.4,5.4c0.4,0.4,1,0.4,1.4,0C26.1,26.6,26.1,25.9,25.8,25.5z M11.9,21.9c-5.5,0-9.9-4.4-9.9-9.9S6.4,2,11.9,2c5.5,0,9.9,4.4,9.9,9.9S17.4,21.9,11.9,21.9z'/%3e%3c/svg%3e");
        mask-repeat: no-repeat;
        mask-position: center;
      }
    }

    &:focus {
      outline: solid 4px transparent;
      outline-offset: -4px;
      box-shadow: none;

      & span::after {
        transform: scaleX(1);
      }
    }

    @media (min-width: 43.75rem) {
      width: 5rem;
    }
  }

  /* 500px is the width of the primary nav at mobile. */
  @media (min-width: 31.25rem) {
    margin-inline-start: 0;
    margin-inline-end: 0;
  }
}

body:not(.is-always-mobile-nav) .block-search-narrow {
  @media (min-width: 75rem) {
    display: none;
  }
}

[dir="rtl"] .block-search-narrow {
  & input[type="search"] {
    background-position: bottom right;
  }

  & .search-form__submit .icon--search::after {
    transform-origin: right;
  }
}
