/* Defines the styles for Subtle search bar. */
.header-search {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-toggle-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #000000;
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 0;
}

.search-toggle-mobile svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-bar input[type="search"] {
  width: 140px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 2.1rem 0.45rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--ink);
  background: #ffffff;
  transition: width 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input[type="search"]::placeholder {
  color: var(--slate);
}

.search-bar input[type="search"]:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.6);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
  width: 180px;
}

.search-icon {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: #000000;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
}

.search-icon:hover,
.search-icon:focus-visible {
  color: #000000;
}

.search-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

body.is-search-open {
  overflow: hidden;
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 11000;
}

body.is-search-open .search-overlay {
  opacity: 1;
  pointer-events: auto;
}

.search-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: #ffffff;
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 50px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 12000;
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: 1.5rem 1.5rem 1.75rem;
}

body.is-search-open .search-drawer {
  transform: translateX(0);
}

.search-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.search-drawer-title {
  margin: 0;
  font-size: 1.1rem;
}

.search-drawer-close {
  border: none;
  background: #ffffff;
  color: #000000;
  width: 32px;
  height: 32px;
  border-radius: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.search-drawer-close:hover,
.search-drawer-close:focus-visible {
  color: #000000;
}

.search-drawer-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  margin-top: 0.75rem;
}

.search-drawer-input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--teal);
}

.search-drawer-input::-webkit-search-cancel-button {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 0;
  background: #000000;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox=\"0 0 12 12\"><path d=\"M2 2l8 8M10 2L2 10\" stroke=\"%23000\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>') center / contain no-repeat;
}

.search-drawer-input::-webkit-search-cancel-button:active {
  background: #000000;
}

.search-drawer-body {
  margin-top: 1rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  display: grid;
  gap: 1rem;
}

.search-guidance {
  font-size: 0.9rem;
  color: var(--slate);
}

.search-guidance ul {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-guidance button {
  border: 1px solid rgba(15, 118, 110, 0.25);
  background: rgba(15, 118, 110, 0.08);
  color: var(--teal);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.search-guidance button:hover,
.search-guidance button:focus-visible {
  border-color: var(--teal);
}

.search-group {
  display: grid;
  gap: 0.5rem;
}

.search-group-title {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
}

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.search-results li {
  margin: 0;
}

.search-result {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  background: rgba(15, 118, 110, 0.06);
  display: grid;
  gap: 0.2rem;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.search-result:hover,
.search-result:focus-visible {
  border-color: rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.12);
}

.result-title {
  font-weight: 600;
}

.result-meta {
  font-size: 0.78rem;
  color: var(--slate);
}

.result-context {
  font-size: 0.72rem;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.search-empty {
  padding: 0.5rem 0;
  color: var(--slate);
  font-size: 0.9rem;
}

.search-highlight {
  animation: search-highlight 1.4s ease;
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: 6px;
  border-radius: 12px;
}

@keyframes search-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.35);
  }

  100% {
    box-shadow: 0 0 0 18px rgba(15, 118, 110, 0);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 737px) {
  .header-search {
    display: block;
    grid-column: 3 / 4;
    justify-self: end;
    align-self: center;
  }

  .header-actions {
    display: none;
  }

  .search-toggle-mobile {
    display: none;
  }

  .search-bar input[type="search"] {
    width: 170px;
  }

  .search-bar input[type="search"]:focus {
    width: 220px;
  }
}
