/* ==============================================================
   Site-wide search: the header flyout (every page) + result rows
   and the status bar (blog.html's full results page)
   ============================================================== */

/* --- Flyout panel -------------------------------------------------- */

.search-flyout-wrap {
  position: relative;
}

.search-flyout {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 60;
  width: min(380px, 92vw);
  max-height: 70vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-color3, #212e2b);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  transform-origin: top right;
  transform: scale(0.95) translateY(-8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .16s ease, opacity .16s ease, visibility 0s linear .16s;
}

.search-flyout-wrap.is-open .search-flyout {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform .16s ease, opacity .16s ease, visibility 0s;
}

/* Themed scrollbar for the results list, invisible until the panel is
   actually being interacted with — a plain always-on browser scrollbar
   here would fight the "small, unobtrusive flyout" design. */
.search-flyout {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.search-flyout:hover,
.search-flyout:focus-within {
  scrollbar-color: rgba(84, 184, 147, 0.45) transparent;
}

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

.search-flyout::-webkit-scrollbar-track {
  background: transparent;
}

.search-flyout::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

.search-flyout:hover::-webkit-scrollbar-thumb,
.search-flyout:focus-within::-webkit-scrollbar-thumb {
  background: rgba(84, 184, 147, 0.45);
}

/* Full-width strip under the header instead of a corner-anchored box —
   there's no button corner to unfold from at this width, and a fixed
   ~380px panel would run off-screen anyway. --search-flyout-top is kept in
   sync with the header's actual rendered height by site-search.js. */
@media (max-width: 575px) {
  .search-flyout {
    position: fixed;
    top: var(--search-flyout-top, 70px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100vh - var(--search-flyout-top, 70px) - 24px);
    transform-origin: top center;
  }
}

.search-flyout__form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.search-flyout__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--vs-border-color4, #3c4945);
  background: var(--bg-color, #121f1f);
  color: var(--title-color, #fff);
  font-size: 0.9rem;
}

.search-flyout__input:focus {
  outline: none;
  border-color: var(--vs-theme-color2, #54b893);
}

.search-flyout__submit {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--vs-border-color4, #3c4945);
  background: transparent;
  color: var(--vs-theme-color2, #54b893);
}

.search-flyout__submit:hover {
  border-color: var(--vs-theme-color2, #54b893);
}

.search-flyout__results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-flyout__message {
  margin: 6px 2px;
  font-size: 0.85rem;
  color: rgba(246, 245, 245, 0.6);
}

.search-flyout__view-all {
  display: block;
  margin-top: 2px;
  padding: 8px;
  text-align: center;
  border-radius: 8px;
  border: 1px dashed var(--vs-border-color4, #3c4945);
  color: var(--vs-theme-color2, #54b893);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.search-flyout__view-all:hover {
  border-color: var(--vs-theme-color2, #54b893);
  color: var(--vs-theme-color, #2f907a);
}

/* --- Result rows — shared by the flyout and blog.html's full results
   page. Same visual language as .post-card in style.css (border/background/
   hover treatment) but laid out horizontally so an excerpt has room. --- */

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 29, 29, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: var(--vs-title-color, #fff);
  text-decoration: none;
  transition: transform .15s, border-color .15s, background .15s, color .15s;
}

/* Inside the flyout, rows are tighter — smaller thumbnail, no wasted gap. */
.search-flyout__results .search-result {
  gap: 10px;
  padding: 8px;
}

.search-result:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 184, 147, 0.5);
  background: rgba(84, 184, 147, 0.12);
  color: #fff;
}

.search-result:hover .search-result__title {
  color: var(--vs-theme-color, #54b893);
}

.search-result__thumb {
  flex: none;
  display: block;
  width: 96px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.search-flyout__results .search-result__thumb {
  width: 56px;
}

.search-result__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A post with no thumbnail, or an FAQ entry (which has no image at all) —
   same footprint as a real thumbnail so rows stay aligned. */
.search-result__thumb--none,
.search-result__thumb--faq {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vs-theme-color2);
  font-family: var(--title-font);
  font-size: 1.5rem;
  font-weight: 700;
}

@media (max-width: 575px) {
  .search-result__thumb {
    width: 64px;
  }
}

.search-result__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.search-result__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result__tag {
  flex: none;
  font-family: var(--title-font);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(84, 184, 147, 0.18);
  color: var(--vs-theme-color, #54b893);
  white-space: nowrap;
}

.search-result__date {
  flex: none;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(246, 245, 245, 0.55);
  white-space: nowrap;
}

.search-result__title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  transition: color .15s;
}

.search-flyout__results .search-result__title {
  font-size: 0.85rem;
}

.search-result__excerpt {
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(246, 245, 245, 0.7);
}

.search-flyout__results .search-result__excerpt {
  font-size: 0.78rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result__title mark,
.search-result__excerpt mark {
  background: rgba(84, 184, 147, 0.35);
  color: var(--title-color, #fff);
  border-radius: 2px;
  padding: 0 2px;
}

/* --- Status bar — blog.html's full results page only --- */

.search-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
  padding: 14px 20px;
  border: 1px solid var(--vs-border-color4);
  border-radius: 8px;
  background: var(--bg-color3);
  color: var(--body-color);
}

.search-status__text strong {
  color: var(--title-color);
}

.search-status__clear {
  flex-shrink: 0;
  color: var(--vs-theme-color2);
  text-decoration: underline;
  white-space: nowrap;
}

.search-status__clear:hover {
  color: var(--vs-theme-color);
}
