/* ==========================================================================
   Buscador del header — overlay (template-parts/search-overlay.php)
   ========================================================================== */
html.vg-search-open { overflow: hidden; }

.vg-search {
  position: fixed;
  inset: 0;
  z-index: 100000;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.vg-search[hidden] { display: none; }

.vg-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, .45);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .2s ease;
}

.vg-search__panel {
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem 0 2.5rem;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .12);
  transform: translateY(-12px);
  opacity: 0;
  transition: transform .25s ease, opacity .2s ease;
}

.vg-search.is-open .vg-search__backdrop { opacity: 1; }
.vg-search.is-open .vg-search__panel { transform: none; opacity: 1; }

/* Campo */
.vg-search__form {
  position: relative;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .4rem .5rem .4rem 1.1rem;
  background: #f6f5f1;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 14px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.vg-search__form:focus-within {
  background: #fff;
  border-color: #1c1c1c;
  box-shadow: 0 0 0 3px var(--kraft-claro, #EBCFB8);
}
.vg-search__icon { flex: 0 0 22px; width: 22px; height: 22px; color: #6f6f6a; }

.vg-search__input {
  flex: 1;
  min-width: 0;
  padding: .8rem 0;
  font: inherit;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: #1c1c1c;
  background: transparent;
  border: 0;
  outline: none;
  -webkit-appearance: none;
          appearance: none;
}
.vg-search__input::placeholder { color: #9b9a93; }
.vg-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.vg-search__kbd {
  padding: .2rem .45rem;
  font-family: inherit;
  font-size: .7rem;
  color: #6f6f6a;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 5px;
}

.vg-search__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #1c1c1c;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .2s;
}
.vg-search__close svg { width: 22px; height: 22px; }
.vg-search__close:hover { background: #eeeeeb; }

/* Etiquetas y estado inicial */
.vg-search__label {
  margin: 1.75rem 0 .8rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8a8a86;
}
.vg-search__chips,
.vg-search__quick {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.vg-search__chips li,
.vg-search__quick li { margin: 0; padding: 0; }

.vg-search__chips a {
  display: inline-block;
  padding: .45rem .95rem;
  font-size: .85rem;
  color: #1c1c1c;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 50rem;
  transition: border-color .2s, background-color .2s;
}
.vg-search__chips a:hover { border-color: #1c1c1c; background: var(--kraft-tinte, #F3E3D3); }

.vg-search__quick a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 0;
  margin-right: 1.25rem;
  font-size: .95rem;
  font-weight: 500;
  color: #1c1c1c;
  text-decoration: none;
}
.vg-search__quick a span { transition: transform .25s ease; }
.vg-search__quick a:hover span { transform: translateX(3px); color: var(--book-cloth, #CC785C); }

/* Resultados */
.vg-search__results:empty { display: none; }
.vg-search__results { margin-top: 1.25rem; }

.vg-search__list { margin: 0; padding: 0; list-style: none; }
.vg-search__list li { margin: 0; padding: 0; }
.vg-search__list a {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .95rem .75rem;
  color: #1c1c1c;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  border-radius: 8px;
  transition: background-color .15s;
}
.vg-search__list a:hover,
.vg-search__list a:focus {
  outline: none;
  background: #f6f5f1;
}
.vg-search__type {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8a8a86;
}
.vg-search__title { font-size: 1rem; font-weight: 500; line-height: 1.35; }
.vg-search__title mark {
  padding: 0 .1em;
  color: inherit;
  background: var(--kraft-tinte, #F3E3D3);
  border-radius: 3px;
}
.vg-search__arrow { color: #9b9a93; transition: transform .25s ease, color .2s; }
.vg-search__list a:hover .vg-search__arrow,
.vg-search__list a:focus .vg-search__arrow { transform: translateX(3px); color: var(--book-cloth, #CC785C); }

.vg-search__all {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  color: #1c1c1c;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.vg-search__all:hover { color: var(--book-cloth, #CC785C); }

.vg-search__empty,
.vg-search__loading {
  margin: 0;
  padding: .75rem 0;
  font-size: .95rem;
  color: #6f6f6a;
}

@media (max-width: 575.98px) {
  .vg-search__panel { max-height: 100vh; height: 100vh; padding-top: 1rem; }
  .vg-search__kbd { display: none; }
  .vg-search__list a { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; }
  .vg-search__type { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .vg-search__panel, .vg-search__backdrop { transition: none; }
}
