/* Search overlay — reference layout: centered search + 2-line italic copy */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  min-height: clamp(200px, 28vh, 260px);
  background: transparent;
  overflow: visible;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(-100%);
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.45s;
}

.search-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
  transform: translateY(0);
}

.search-overlay__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(100% - clamp(4.5rem, 9vw, 5.5rem));
  background: #f2f3f7;
  z-index: 0;
}

.cloud-divider {
  position: absolute;
  top: calc(100% - clamp(4.5rem, 9vw, 5.5rem));
  left: 0;
  width: 100%;
  height: clamp(4.5rem, 9vw, 5.5rem);
  pointer-events: none;
  z-index: 1;
  display: block;
}

.cloud-divider path {
  fill: #f2f3f7;
}

/* Close — flush to viewport top-right (not page gutter) */
.close-btn {
  position: fixed;
  top: 1.125rem;
  right: 1.125rem;
  border: none;
  background: none;
  font-size: 1.65rem;
  font-weight: 300;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  z-index: 1110;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #0f172a;
}

.search-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 2.75rem 1.5rem calc(4.5rem + 0.35rem);
  text-align: center;
  position: relative;
  z-index: 10;
}

.search-form {
  margin: 0;
}

/* Centered search row + blue rule (~half width like reference) */
.search-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  width: min(32rem, 52%);
  min-width: min(100%, 18rem);
  margin: 0 auto;
  border-bottom: 3px solid #3358d4;
  padding-bottom: 0.5rem;
  text-align: left;
}

.search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  outline: none;
  color: #1e293b;
  font-family: inherit;
  font-weight: 400;
}

.search-box input::placeholder {
  color: #94a3b8;
}

.search-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  color: #1e293b;
}

/* Two centered italic lines, tight under the rule */
.search-text {
  margin: 0.85rem auto 0;
  padding: 0;
  width: min(42rem, 92%);
  font-size: clamp(0.95rem, 1.35vw, 1.125rem);
  color: #334155;
  font-style: italic;
  line-height: 1.55;
  text-align: center;
}

.search-text__line {
  display: inline;
}

.search-text strong {
  font-weight: 700;
  font-style: italic;
}

.search-text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.search-text a:hover {
  color: #0f172a;
}

.search-results-wrap {
  margin: 1rem auto 0;
  padding-top: 0.85rem;
  border-top: 1px solid #d1d5db;
  text-align: left;
  width: min(32rem, 52%);
  min-width: min(100%, 18rem);
}

.search-results-label {
  margin: 0 0 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0f172a;
  font-style: normal;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.search-result-link {
  display: block;
  padding: 0.55rem 0.65rem;
  text-decoration: none;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #e5e7eb;
  border-radius: 0;
  transition: background 0.15s, border-color 0.15s;
}

.search-result-link:hover,
.search-result-link:focus-visible {
  background: #ffffff;
  border-color: #cbd5e1;
}

.search-result-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  font-style: normal;
}

.search-result-snippet {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #64748b;
  font-style: normal;
}

.search-highlight {
  background: var(--accent-warm, #f97316);
  color: #1e293b;
  color: inherit;
  font-weight: 600;
  font-style: inherit;
  padding: 0 0.12em;
  border-radius: 0;
}

.search-empty {
  margin: 1rem auto 0;
  font-size: 0.9rem;
  color: #64748b;
  font-style: italic;
}

body.site-search-open .site-header {
  visibility: hidden;
}

body.site-search-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .search-box {
    width: min(100%, 20rem);
  }

  .search-results-wrap {
    width: min(100%, 20rem);
  }
}

@media (max-width: 575px) {
  .search-overlay {
    min-height: clamp(188px, 26vh, 240px);
  }

  .search-overlay__backdrop {
    height: calc(100% - 4rem);
  }

  .cloud-divider {
    top: calc(100% - 4rem);
    height: 4rem;
  }

  .search-container {
    padding: 2.25rem 1rem calc(4rem + 0.25rem);
  }

  .close-btn {
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.5rem;
  }

  .search-box {
    width: 100%;
    max-width: 20rem;
  }

  .search-text {
    margin-top: 0.65rem;
    width: 100%;
    font-size: 0.875rem;
    line-height: 1.45;
  }

  .search-results-wrap {
    width: 100%;
    max-width: 20rem;
  }
}
