﻿/* Wrapper ensures the trigger hugs the right edge of the header navigation */
.ols-search-inline {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 20px;
  pointer-events: none; /* allow clicks to pass through when closed */
}

.ols-search-inline.is-open {
  pointer-events: auto;
}

/* Icon button */
.ols-search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  line-height: 1;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.ols-search-toggle:focus,
.ols-search-toggle:focus-visible {
  outline: none;
}

.ols-search-inline.is-open .ols-search-toggle {
  opacity: 0;
  pointer-events: none;
}

.ols-search-toggle svg {
  display: block;
}

.ols-search-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ols-search-toggle__icon--mobile {
  display: none;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.ols-search-inline.ols-is-mobile .ols-search-toggle__icon--default {
  display: none;
}

.ols-search-inline.ols-is-mobile .ols-search-toggle__icon--mobile {
  display: inline-flex;
}

/* Expanding field */
.ols-search-field {
  position: fixed;
  right: var(--ols-search-right, 1.5rem);
  top: var(--ols-search-top, 3rem);
  width: var(--ols-search-width, min(420px, 70vw));
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scaleX(0.85);
  transform-origin: right center;
  transition: transform 0.35s ease, opacity 0.2s ease;
  z-index: 1000;
}

.ols-search-inline.is-open .ols-search-field {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scaleX(1);
}

.ols-search-field__inner {
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  text-align: left;
}

.ols-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.ols-search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  color: #0a1018;
  font-size: 1rem;
  padding: 0.6rem 2.5rem 0.6rem 2.25rem;
  border-radius: 999px;
  padding-left: 2.7rem;
}

.ols-search-form input[type="search"]::placeholder {
  color: rgba(10, 16, 24, 0.6);
}

.ols-search-form input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 0;
  width: 0;
  margin: 0;
}

.ols-search-form input[type="search"]:focus {
  outline: none;
  box-shadow: none;
}

.ols-search-form__icon {
  position: absolute;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #0a1018;
}

.ols-search-form__icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.ols-search-close {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  color: #0a1018;
  font-size: 1.35rem;
  line-height: 1;
  padding-bottom: 1.3rem;
  cursor: pointer;
}

.ols-search-close:focus-visible {
  outline: 2px solid #0017c2;
  border-radius: 999px;
}

@media (max-width: 1025px) {
  .ols-search-inline {
    margin-left: 0;
    justify-content: center;
    width: 100%;
  }

  .ols-search-toggle {
    padding: 0;
  }

  .ols-search-toggle__icon--default {
    display: none;
  }

  .ols-search-toggle__icon--mobile {
    display: inline-flex;
  }

  .ols-search-field {
    left: var(--ols-search-center, 50%);
    right: auto;
    transform: translate(-50%, -50%) scaleX(0.85);
    transform-origin: center;
  }

  .ols-search-inline.is-open .ols-search-field {
    transform: translate(-50%, -50%) scaleX(1);
  }
}
