/* =================================================================
 * HSST 全站搜索組件  hsst-site-search.css  v20261012a
 * 導航欄可折疊搜索框 + 實時下拉結果 + /search.html 結果頁
 * ================================================================= */

/* ---------- 導航欄搜索入口 ---------- */
.hsst-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}
/* 搜索框緊鄰語言切換器（覆蓋 .lang-switch 的 40px / auto 外邊距） */
.hsst-search + .lang-switch.lang-switch-top,
body.premium .navbar .hsst-search + .lang-switch.lang-switch-top {
  margin-left: 12px !important;
}
.hsst-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1A1A2E;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.hsst-search-btn:hover {
  background: rgba(201, 168, 76, .14);
  color: #C9A84C;
}
.hsst-search-btn svg { width: 19px; height: 19px; display: block; }
.hsst-search-form {
  display: flex;
  align-items: center;
  width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: width .28s cubic-bezier(.22,.61,.36,1), opacity .2s ease;
}
.hsst-search-input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1.5px solid rgba(26, 26, 46, .28);
  background: transparent;
  padding: 8px 4px;
  font-size: 14px;
  font-family: inherit;
  color: #1A1A2E;
  outline: none;
  border-radius: 0;
}
.hsst-search-input::placeholder { color: rgba(26, 26, 46, .42); }
.hsst-search-input:focus { border-bottom-color: #C9A84C; }
.hsst-search-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(26, 26, 46, .55);
  cursor: pointer;
  flex-shrink: 0;
}
.hsst-search-close:hover { background: rgba(26,26,46,.06); color: #1A1A2E; }
.hsst-search-close svg { width: 15px; height: 15px; }

.hsst-search.expanded { z-index: 1060; }
.hsst-search.expanded .hsst-search-form {
  width: clamp(180px, 28vw, 330px);
  opacity: 1;
  pointer-events: auto;
  margin-left: 6px;
}
.hsst-search.expanded .hsst-search-btn { display: none; }

/* ---------- 下拉結果面板 ---------- */
.hsst-search-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(560px, 92vw);
  max-height: min(70vh, 620px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(26, 26, 46, .08);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(17, 17, 17, .16);
  padding: 8px;
  display: none;
  z-index: 1080;
  overscroll-behavior: contain;
}
.hsst-search.open .hsst-search-panel { display: block; }
.hsst-search-panel .hsst-spinner,
.hsst-search-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  font-size: 13.5px;
  color: rgba(26, 26, 46, .6);
}
.hsst-spinner { justify-content: center; }
.hsst-spinner::before {
  content: "";
  width: 17px;
  height: 17px;
  border: 2px solid rgba(201, 168, 76, .25);
  border-top-color: #C9A84C;
  border-radius: 50%;
  animation: hsst-spin .7s linear infinite;
}
@keyframes hsst-spin { to { transform: rotate(360deg); } }

.hsst-sg { padding: 4px 0 8px; }
.hsst-sg + .hsst-sg { border-top: 1px solid rgba(26,26,46,.07); }
.hsst-sg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: rgba(26, 26, 46, .45);
  text-transform: uppercase;
}
.hsst-sg-list { list-style: none; margin: 0; padding: 0; }
.hsst-opt {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #1A1A2E;
  cursor: pointer;
}
.hsst-opt:hover,
.hsst-opt[aria-selected="true"] { background: rgba(201,168,76,.1); outline: none; }
.hsst-opt-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hsst-opt-url {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: rgba(26,26,46,.42);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hsst-search-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 4px 2px;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #8a6d2b;
  background: rgba(201,168,76,.08);
  text-decoration: none;
}
.hsst-search-more:hover { background: rgba(201,168,76,.16); }
mark.hsst-mark {
  background: rgba(201,168,76,.32);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------- 搜索結果頁 /search.html ---------- */
.hsst-rpage { padding-top: calc(var(--nav-height, 72px) + 18px); }
.hsst-rpage .hsst-rwrap { max-width: 920px; }
.hsst-rbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
  padding: 6px 8px 6px 18px;
  background: #fff;
  border: 1px solid rgba(26,26,46,.12);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(17,17,17,.06);
}
.hsst-rbox svg { width: 19px; height: 19px; color: rgba(26,26,46,.45); flex-shrink: 0; }
.hsst-rinput {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 12px 4px;
  color: #1A1A2E;
  font-family: inherit;
}
.hsst-rbtn {
  border: 0;
  border-radius: 999px;
  padding: 11px 26px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #C9A84C, #b8860b);
  cursor: pointer;
  flex-shrink: 0;
}
.hsst-rbtn:hover { filter: brightness(1.05); }
.hsst-rmeta { font-size: 13px; color: rgba(26,26,46,.5); margin: 4px 4px 0; min-height: 20px; }
.hsst-rgroup { margin-top: 26px; }
.hsst-rgroup-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(26,26,46,.1);
}
.hsst-rgroup-head h2 { font-size: 18px; font-weight: 700; color: #1A1A2E; margin: 0; }
.hsst-rgroup-head span { font-size: 13px; color: rgba(26,26,46,.5); }
.hsst-ritem {
  display: block;
  padding: 14px 16px;
  border: 1px solid rgba(26,26,46,.07);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
  text-decoration: none;
  color: #1A1A2E;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.hsst-ritem:hover {
  border-color: rgba(201,168,76,.55);
  box-shadow: 0 10px 26px rgba(17,17,17,.08);
  transform: translateY(-1px);
}
.hsst-ritem-title { font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.hsst-ritem-url { font-size: 12px; color: #8a6d2b; margin-top: 3px; word-break: break-all; }
.hsst-ritem-snip { font-size: 13.5px; line-height: 1.7; color: rgba(26,26,46,.66); margin-top: 6px; }
.hsst-rempty {
  text-align: center;
  padding: 64px 20px;
  color: rgba(26,26,46,.55);
}
.hsst-rempty .big { font-size: 40px; display: block; margin-bottom: 12px; }
.hsst-rempty h3 { font-size: 18px; color: #1A1A2E; margin: 0 0 8px; font-weight: 700; }
.hsst-rempty p { font-size: 14px; line-height: 1.8; margin: 0; }
.hsst-rtips { margin-top: 18px; text-align: left; display: inline-block; }
.hsst-rtips li { margin: 4px 0; }

/* ---------- 平板 / 手機 ---------- */
@media (max-width: 900px) {
  .hsst-search { margin-left: auto; }
  .hsst-search + .lang-switch.lang-switch-top { margin-left: 8px !important; }
  .hsst-search.expanded {
    position: absolute;
    top: 0;
    left: 8px;
    right: 8px;
    height: var(--nav-height, 72px);
    margin-left: 0;
    background: rgba(245, 240, 235, .98);
    border-radius: 0 0 12px 12px;
  }
  .hsst-search.expanded .hsst-search-form {
    width: auto;
    flex: 1;
    margin-left: 4px;
  }
  .hsst-search-panel {
    top: var(--nav-height, 72px);
    right: -8px;
    left: -8px;
    width: auto;
    max-height: calc(100vh - var(--nav-height, 72px) - 12px);
    border-radius: 12px 12px 0 0;
  }
}
@media (max-width: 600px) {
  .hsst-rbtn { padding: 10px 18px; }
  .hsst-rinput { font-size: 14px; }
}
