/* ==========================================================
   HollowLight — Search Modal
   ZZZ InterKnot aesthetic: dark, yellow accent, frosted glass
   ========================================================== */

/* --- Overlay --- */
.hl-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998; /* below window popup, above header */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.hl-search-overlay[hidden] {
  display: none;
}

.hl-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: hl-sb-in 180ms ease both;
}

@keyframes hl-sb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Modal card --- */
.hl-search-modal {
  position: relative;
  z-index: 1;
  width: 640px;
  max-width: calc(100vw - 32px);
  background: #181818;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(251, 254, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  animation: hl-sm-in 200ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes hl-sm-in {
  from { opacity: 0; transform: scale(0.94) translateY(-16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Input row --- */
.hl-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.hl-search-icon-prefix {
  color: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.hl-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 18px;
  font-family: var(--hl-font);
  line-height: 1.5;
  min-width: 0;
}

.hl-search-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* Remove native search clear button */
.hl-search-input::-webkit-search-cancel-button,
.hl-search-input::-webkit-search-decoration { display: none; }

.hl-search-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.hl-search-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.hl-search-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

/* --- Body / results area --- */
.hl-search-body {
  min-height: 80px;
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hl-search-body::-webkit-scrollbar { width: 4px; }
.hl-search-body::-webkit-scrollbar-track { background: transparent; }
.hl-search-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* --- Hint (idle state) --- */
.hl-search-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 0;
  color: rgba(255, 255, 255, 0.18);
  font-size: 14px;
}

.hl-search-hint svg {
  opacity: 0.4;
}

/* --- Empty state --- */
.hl-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 0;
  color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
}

.hl-search-empty svg { opacity: 0.3; }

/* --- Result items --- */
.hl-search-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.hl-search-item:hover,
.hl-search-item[aria-selected="true"] {
  background: rgba(251, 254, 0, 0.055);
}

.hl-search-item[aria-selected="true"] .hl-search-item-title {
  color: var(--hl-accent, #fbfe00);
}

.hl-search-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.45;
  transition: color 0.1s;
}

.hl-search-item-excerpt {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hl-search-item-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.hl-search-item-tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  color: rgba(251, 254, 0, 0.55);
  background: rgba(251, 254, 0, 0.06);
  border: 1px solid rgba(251, 254, 0, 0.14);
  border-radius: 20px;
}

/* Keyword highlight */
.hl-search-body mark {
  background: rgba(251, 254, 0, 0.22);
  color: var(--hl-accent, #fbfe00);
  border-radius: 2px;
  padding: 0 1px;
}

/* --- Footer hints --- */
.hl-search-footer {
  display: flex;
  gap: 16px;
  padding: 9px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
}

.hl-search-footer kbd {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  margin-right: 2px;
}

/* --- Header search trigger button --- */
.hl-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color 0.2s, background 0.2s;
}

.hl-search-btn:hover {
  color: var(--hl-accent, #fbfe00);
  background: rgba(251, 254, 0, 0.08);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .hl-search-overlay { padding-top: 16px; }
  .hl-search-footer  { display: none; }
  .hl-search-modal   { border-radius: 14px; }
}
