@media (min-width: 900px) {
  input,
  textarea {
    padding-bottom: 0.5rem !important;
  }
}

/*
 * Search highlights and hover washes are the link blue at low opacity. There
 * is no token for its channels, so the two search blocks carry their own:
 * the light link blue, and the dark theme's lighter one.
 */
.search-page-section,
.search-modal {
  --search-wash--rgb: var(--color-blue-100--rgb);
  --search-url: var(--color-green-100);
}

html[data-theme="dark"] .search-page-section,
html[data-theme="dark"] .search-modal {
  --search-wash--rgb: 62, 166, 255;
  --search-url: #81c995;
}

.search-page-section {
  margin-top: 14rem;
  background-color: var(--color-bg-primary);
  min-height: 80vh;
  min-height: 80svh;
}

@media (min-width: 900px) and (max-width: 1199px) {
  .search-page-section {
    margin-top: 10rem;
  }
}

.search-header-block {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.search-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
}

.query-text {
  color: var(--color-link);
}

.search-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 15px;
}

.search-stats {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.search-refine-form {
  flex-grow: 1;
  max-width: 400px;
}

.custom-search-form {
  width: 100%;
}

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

.custom-search-form .search-field {
  width: 100%;
  height: 48px;
  padding: 0 12px !important;
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-text-muted);
  border-radius: 0;
  font-size: 1.2rem;
  color: var(--color-text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.custom-search-form .search-field:hover {
  border-color: var(--color-grey-100);
}

.custom-search-form .search-field:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(var(--color-blue-100--rgb), 0.1);
  outline: none;
}

.custom-search-form .search-field::placeholder {
  color: var(--color-text-secondary);
}

.custom-search-form .search-submit {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 48px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-primary);
  transition: color 0.3s ease, transform 0.3s ease;
  z-index: 10;
  padding: 0;
}

.custom-search-form .search-submit:hover {
  color: var(--color-link);
  transform: scale(1.1);
}

.custom-search-form .search-submit svg {
  width: 20px;
  height: 20px;
  display: block;
}

.search-list {
  display: flex;
  flex-direction: column;
}

.search-item {
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease;
}

.search-item:first-child {
  padding-top: 1rem;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item__meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-item__type {
  font-weight: 500;
  text-transform: uppercase;
  color: var(--color-text-primary);
}

.search-item__title {
  font-size: 1.375rem;
  line-height: 1.4;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.search-item__title a {
  color: var(--color-link);
  text-decoration: none;
}

.search-item__title a:hover {
  text-decoration: underline;
  color: var(--color-text-heading);
}

.search-item__url {
  font-size: 0.85rem;
  color: var(--search-url);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.5rem;
}

.search-item__excerpt {
  color: var(--color-text-primary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 95%;
}

.search-item__excerpt strong {
  color: var(--color-text-primary);
  font-weight: 700;
}

.search-item__excerpt mark {
  background-color: rgba(var(--search-wash--rgb), 0.12) !important;
  color: var(--color-text-heading) !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  box-shadow: inset 0 -1px 0 rgba(var(--color-blue-100--rgb), 0.2);
}
.search-pagination {
  margin-top: 1.5rem;
  margin-bottom: 3rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

.search-pagination .nav-links {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.search-pagination .pagination__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  text-decoration: none;
}

.search-pagination .pagination__link:not(.active):hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-text-muted);
  color: var(--color-text-primary);
  transform: translateY(-2px);
}

.search-pagination .pagination__link.active {
  background: var(--color-blue-200);
  border-color: var(--color-blue-200);
  color: var(--color-white);
  font-weight: 600;
}

.search-empty-state {
  padding: 3rem 0;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

@media (max-width: 768px) {
  .search-meta-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-refine-form,
  .custom-search-form,
  .custom-search-form .search-field {
    width: 100%;
  }

  .search-refine-form {
    max-width: 100%;
  }

  .search-item__excerpt {
    max-width: 100%;
    font-size: 0.95rem;
  }
}

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background-color: rgba(var(--color-bg-primary--rgb), 0.95);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  touch-action: none;
}



.search-modal._opened {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-modal__container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  background-color: var(--color-surface-card);
  margin-top: 100px;
  padding: 60px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  /* Comes down from the header, where the search button is, not up from below. */
  transform: translateY(-16px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-modal._opened .search-modal__container {
  transform: translateY(0);
}

.search-modal__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: var(--color-blue-200);
  border: none;
  cursor: pointer;
  color: var(--color-white);
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  z-index: 10;
}

.search-modal__close:hover {
  background-color: var(--color-black);
}

.search-modal__close svg,
.search-modal__close img {
  width: 20px;
  height: 20px;
  transition: transform 0.4s ease;
  display: block;
}

.search-modal__close:hover svg,
.search-modal__close:hover img {
  transform: rotate(90deg);
}

.search-modal__title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  font-weight: 600;
  text-align: left;
}

.search-modal__form-wrapper {
  position: relative;
  width: 100%;
}

.search-modal__form-wrapper form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
}

.search-modal__form-wrapper input[type="search"],
.search-modal__form-wrapper input[type="text"] {
  width: 100%;
  height: 80px;
  font-family: "Roboto", sans-serif;
  font-size: 2.25rem;
  font-weight: 400;
  line-height: normal;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--color-text-muted);
  border-radius: 0;
  padding: 0 96px 8px 0 !important;
  margin: 0;
  transition: border-color 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.search-modal__form-wrapper input[type="search"]::-webkit-search-decoration,
.search-modal__form-wrapper input[type="search"]::-webkit-search-cancel-button,
.search-modal__form-wrapper input[type="search"]::-webkit-search-results-button,
.search-modal__form-wrapper input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

.search-modal__form-wrapper input[type="search"]:focus,
.search-modal__form-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search-modal__form-wrapper input::-webkit-input-placeholder {
  color: var(--color-text-muted);
  opacity: 0.55;
  font-weight: 400;
  font-family: "Roboto", sans-serif;
  font-size: inherit;
  line-height: normal;
}

.search-modal__form-wrapper input::-moz-placeholder {
  color: var(--color-text-muted);
  opacity: 0.55;
  font-weight: 400;
  font-family: "Roboto", sans-serif;
  font-size: inherit;
  line-height: normal;
}

.search-modal__form-wrapper input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.55;
  font-weight: 400;
  font-family: "Roboto", sans-serif;
  font-size: inherit;
  line-height: normal;
}

.search-modal__form-wrapper button[type="submit"],
.search-modal__form-wrapper input[type="submit"] {
  position: absolute;
  top: 0;
  right: 0 !important;
  bottom: 0;
  width: 50px;
  height: 100%;
  margin: 0 !important;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-heading);
  transition: transform 0.3s ease, color 0.3s ease;
  z-index: 10;
}

.search-modal__form-wrapper button[type="submit"] svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.5px;
  display: block;
}

.search-modal__form-wrapper button[type="submit"]:hover {
  color: var(--color-text-primary);
  transform: scale(1.1);
}

.search-modal__clear {
  position: absolute;
  top: 0;
  right: 50px !important;
  bottom: 0;
  width: 44px;
  height: 100%;
  margin: 0 !important;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  opacity: 0.5;
  transition: opacity 0.2s ease, color 0.2s ease;
  z-index: 10;
}

.search-modal__clear svg {
  width: 20px;
  height: 20px;
  display: block;
}

.search-modal__clear:hover {
  opacity: 1;
  color: var(--color-text-primary);
}

.live-search-mark {
  background: transparent;
  color: var(--color-text-heading);
  font-weight: 700;
  padding: 0;
}

.live-search-alt-notice {
  padding: 10px 20px 8px;
  font-size: 0.825rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
  background-color: rgba(var(--search-wash--rgb), 0.04);
}

.live-search-alt-notice strong {
  color: var(--color-text-heading);
  font-weight: 600;
}


.live-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--color-surface-card);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 400px;
  overflow-y: auto;
  touch-action: pan-y;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
}

.live-search-dropdown.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.live-search-group {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.live-search-group:last-child {
  border-bottom: none;
}

.live-search-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-primary);
  padding: 0 20px;
  margin-bottom: 8px;
  font-weight: 700;
}

.live-search-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 20px;
  color: var(--color-link);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.live-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-heading);
  opacity: 0.6;
  margin-top: 2px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

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

.live-search-item:hover,
.live-search-item:focus,
.live-search-item.is-selected {
  background-color: rgba(var(--search-wash--rgb), 0.08);
  color: var(--color-text-heading);
  outline: none;
}

.live-search-item:hover .live-search-icon,
.live-search-item:focus .live-search-icon,
.live-search-item.is-selected .live-search-icon {
  color: var(--color-text-heading);
  opacity: 1;
}

.live-search-all-btn {
  display: block;
  text-align: center;
  padding: 15px;
  background: var(--color-blue-200);
  color: var(--color-white);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.live-search-all-btn:hover,
.live-search-all-btn:focus,
.live-search-all-btn.is-selected {
  background-color: var(--color-blue-100);
  outline: none;
}

.live-search-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--color-text-primary);
  font-size: 0.95rem;
}

.live-search-loading {
  padding: 30px;
  display: flex;
  justify-content: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(var(--search-wash--rgb), 0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: live-search-spin 0.8s linear infinite;
}

@keyframes live-search-spin {
  to { transform: rotate(360deg); }
}

.live-search-dropdown::-webkit-scrollbar {
  width: 6px;
}

.live-search-dropdown::-webkit-scrollbar-thumb {
  background: var(--color-text-secondary);
  border-radius: 3px;
}

#live-search-results.is-loading {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.live-search-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.live-search-name {
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.live-search-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--color-text-secondary);
}

.live-search-type {
  font-weight: 400;
  color: var(--color-text-secondary);
  text-transform: none;
  flex-shrink: 0;
}

.live-search-sep {
  color: var(--color-text-secondary);
  opacity: 0.6;
  font-size: 0.7rem;
  user-select: none;
}

.live-search-breadcrumbs {
  font-weight: 400;
  color: var(--color-text-secondary);
  word-break: break-word;
}


@media (max-width: 900px) {
  .search-modal__container {
    padding: 40px 20px;
    max-width: 90%;
  }
  .search-modal__form-wrapper input[type="search"],
  .search-modal__form-wrapper input[type="text"] {
    font-size: 1.75rem;
    height: 60px;
    padding: 0 80px 6px 0 !important;
  }
  .search-modal__clear {
    right: 40px !important;
    width: 36px;
  }
  .search-modal__close {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 600px) {
  .search-modal {
    align-items: flex-start;
    padding-top: 0;
  }
  .search-modal__container {
    margin-top: 0;
    padding: 80px 20px 40px;
    max-width: 100%;
    height: auto;
    min-height: 25vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: none;
    transform: translateY(-100%);
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .search-modal._opened .search-modal__container {
    transform: translateY(0);
  }
  .search-modal__drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: var(--color-border);
    margin: 20px auto 0;
  }
  .search-modal__close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: transparent;
    color: var(--color-text-primary);
  }
  .search-modal__form-wrapper input[type="search"],
  .search-modal__form-wrapper input[type="text"] {
    font-size: 1.35rem;
    height: 50px;
    padding: 0 74px 4px 0 !important;
  }
  .search-modal__clear {
    right: 36px !important;
    width: 32px;
  }

  .live-search-dropdown {
    top: calc(100% + 4px);
    max-height: 52vh;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }

  .live-search-group {
    padding: 6px 0;
  }

  .live-search-group-title {
    padding: 0 12px;
    font-size: 0.675rem;
    margin-bottom: 4px;
  }

  .live-search-item {
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(var(--color-ink--rgb), 0.05);
    -webkit-tap-highlight-color: transparent;
  }

  .live-search-item:last-child {
    border-bottom: none;
  }

  .live-search-item:active {
    background-color: rgba(var(--search-wash--rgb), 0.1);
  }

  .live-search-icon {
    margin-top: 2px;
  }

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

  .live-search-name {
    font-size: 0.875rem;
    line-height: 1.35;
  }

  .live-search-meta {
    margin-top: 3px;
    font-size: 0.7rem;
    line-height: 1.3;
    gap: 4px;
  }

  .live-search-type {
    font-size: 0.675rem;
  }

  .live-search-breadcrumbs {
    font-size: 0.7rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .live-search-all-btn {
    padding: 12px 14px;
    font-size: 0.85rem;
  }

  .live-search-empty {
    padding: 22px 14px;
    font-size: 0.85rem;
  }

  .live-search-alt-notice {
    padding: 8px 12px 6px;
    font-size: 0.75rem;
  }
}



