/* =========================================================
   NovaFolio – Search Overlay
   @since 1.3.0
   Uses #nvf-search-overlay for specificity over main.css
========================================================= */

/* Toggle button */
.nvf-search-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: var(--nvf-space-xs, 6px);
  transition: opacity .2s ease;
}
.nvf-search-toggle:hover{ opacity: .7; }

/* Overlay — hidden by default */
#nvf-search-overlay{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(60px, 12vh, 160px) var(--nvf-space-l, 32px) var(--nvf-space-l, 32px);
  background: var(--nvf-search-overlay-bg, rgba(0, 0, 0, .85));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}
#nvf-search-overlay.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Inner container */
#nvf-search-overlay .nvf-search-overlay__inner{
  width: 100%;
  max-width: 640px;
  position: relative;
}

/* Close button */
#nvf-search-overlay .nvf-search-overlay__close{
  position: absolute;
  top: -48px;
  right: 0;
  background: none;
  border: none;
  color: var(--nvf-search-close-color, rgba(255,255,255,.7));
  cursor: pointer;
  padding: var(--nvf-space-xs, 6px);
  transition: color .2s ease;
  box-shadow: none;
}
#nvf-search-overlay .nvf-search-overlay__close:hover{ color: #fff; }

/* Form */
#nvf-search-overlay .nvf-search-overlay__form{
  margin: 0;
  padding: 0;
}

/* Input — high-specificity override */
#nvf-search-overlay input[type="search"].nvf-search-overlay__input{
  width: 100%;
  max-width: 100%;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-family: inherit;
  font-weight: 300;
  letter-spacing: -.02em;
  color: #fff;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255,255,255,.25);
  border-top: none;
  border-left: none;
  border-right: none;
  padding: var(--nvf-space-s, 12px) 0;
  margin: 0;
  outline: none;
  box-shadow: none;
  caret-color: var(--nvf-color-accent, #4F46E5);
  transition: border-color .2s ease;
  appearance: none;
  -webkit-appearance: none;
  line-height: normal;
  height: auto;
  border-radius: 0;
}
#nvf-search-overlay input[type="search"].nvf-search-overlay__input:focus{
  border-bottom-color: var(--nvf-color-accent, #4F46E5);
  border-color: transparent;
  border-bottom: 2px solid var(--nvf-color-accent, #4F46E5);
  box-shadow: none;
  outline: none;
}
#nvf-search-overlay input[type="search"].nvf-search-overlay__input::placeholder{
  color: rgba(255,255,255,.4);
}

/* Results */
#nvf-search-overlay .nvf-search-overlay__results{
  margin-top: var(--nvf-space-m, 20px);
  max-height: 50vh;
  overflow-y: auto;
}

#nvf-search-overlay .nvf-search-hint,
#nvf-search-overlay .nvf-search-no-results{
  color: rgba(255,255,255,.5);
  font-size: .875rem;
  margin: 0;
}

/* Result item */
#nvf-search-overlay .nvf-search-result{
  display: flex;
  align-items: center;
  gap: var(--nvf-space-s, 12px);
  padding: var(--nvf-space-s, 12px) var(--nvf-space-xs, 6px);
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: background .15s ease;
  border-radius: var(--nvf-radius-s, 6px);
}
#nvf-search-overlay .nvf-search-result:hover{
  background: rgba(255,255,255,.06);
}

#nvf-search-overlay .nvf-search-result__thumb{
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--nvf-radius-xs, 4px);
  overflow: hidden;
  background: rgba(255,255,255,.08);
}
#nvf-search-overlay .nvf-search-result__thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#nvf-search-overlay .nvf-search-nothumb{
  display: block;
  width: 100%;
  height: 100%;
}

#nvf-search-overlay .nvf-search-result__text{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#nvf-search-overlay .nvf-search-result__title{
  font-weight: 500;
  font-size: .9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nvf-search-overlay .nvf-search-result__type{
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Lock body scroll */
body.nvf-search-open{ overflow: hidden; }

/* ── Accessibility: reduce motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nvf-search-toggle,
  #nvf-search-overlay,
  #nvf-search-overlay .nvf-search-overlay__close,
  #nvf-search-overlay input[type="search"].nvf-search-overlay__input,
  #nvf-search-overlay .nvf-search-result {
    transition-duration: 1ms !important;
  }
}
