/* 全站搜尋(canon › Components › 全站搜尋):頂列入口 + 面板。面板跟頁面亮暗走,只用語意
   角色變數(--surface-*、--border-*、--ink*);--ink-3 在兩態都是 greyMedium。 */

/* ── 頂列入口 ── */
header .ss_entry {
  display: flex;
  align-items: center;
}

header .ss_icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  transition: background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}
header .ss_icon::before {
  content: "";
  position: absolute;
  inset: -4px;
}
/* 頂列互動 ②:同漢堡,hover 灰底只給有滑鼠的裝置 */
@media (hover: hover) {
  header .ss_icon:hover {
    background: var(--surface-muted);
    color: var(--ink);
  }
}
header .ss_icon .ico {
  width: 18px;
  height: 18px;
}
/* 已登入列第一顆是下載(只有右距),搜尋與它之間補上同一個 24 */
header .ss_entry ~ #box_nav_right_user {
  margin-left: var(--space-24);
}

/* 按鍵小標(canon › 按鍵小標):只在全站搜尋的入口、tooltip 與面板 */
.ss_kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 20px;
  padding: 0 var(--space-6);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-micro);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--color-greyMedium);
  white-space: nowrap;
}
.tooltip .ss_kbd {
  margin-left: var(--space-6);
  color: inherit;
}

@media (max-width: 768px) {
  /* 手機:icon 20、鈕本身 44(= 熱區,hover 灰底的範圍,同漢堡的 44 方框),在漢堡／大頭貼鈕
     左邊;外距把 icon 拉回原位(左 −12 抵掉框內留白,右 4 + 框內 12 = 原本的 16) */
  header .ss_icon {
    width: 44px;
    height: 44px;
    /* 上下 −2:44 的框不撐高 40 的頂列(同漢堡) */
    margin: calc(-1 * var(--space-2)) var(--space-4) calc(-1 * var(--space-2)) calc(-1 * var(--space-12));
    border-radius: var(--radius-sm);
    color: var(--ink);
  }
  header .ss_icon::before {
    content: none;
  }
  header .ss_icon .ico {
    width: 20px;
    height: 20px;
  }
  header .ss_entry ~ #box_nav_right_user {
    margin-left: 0;
  }
}

/* ── 面板 ── */
html.ss_lock {
  overflow: hidden;
}
.ss_root {
  position: fixed;
  inset: 0;
  z-index: 1060; /* 頂列(fixed-top 1030)之上 */
}
.ss_root[hidden] {
  display: none;
}
.ss_scrim {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
}
.ss_panel {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  width: 640px;
  max-width: calc(100% - 32px);
  max-height: 500px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}
.ss_inrow {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-12);
  height: 52px;
  padding: 0 var(--space-16);
  border-bottom: 1px solid var(--border-hairline);
}
.ss_in_ico {
  width: 18px;
  height: 18px;
  color: var(--color-greyMedium);
}
.ss_root .ss_input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px; /* iOS 不自動放大的下限 */
}
.ss_root .ss_input::placeholder {
  color: var(--color-greyMedium);
}
.ss_cancel {
  display: none;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.ss_list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}
.ss_list:empty {
  display: none;
}
/* 組間距比組內列距大,分組才讀得出來 */
.ss_group + .ss_group {
  margin-top: var(--space-8);
}
.ss_glabel {
  padding: var(--space-8) var(--space-12) var(--space-4);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-greyMedium);
}
.ss_opt {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: 40px;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ss_opt[aria-selected="true"] {
  background: var(--surface-muted);
}
.ss_code {
  flex: none;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.ss_name {
  flex: none;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.ss_opt b {
  font-weight: 700;
}
.ss_loc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--color-greyMedium);
}
.ss_go {
  flex: none;
  visibility: hidden;
  font-size: 12px;
  color: var(--color-greyMedium);
  white-space: nowrap;
}
.ss_opt[aria-selected="true"] .ss_go {
  visibility: visible;
}
.ss_note {
  margin: 0;
  padding: var(--space-16) var(--space-16) var(--space-16);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}
.ss_foot {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-8) var(--space-16);
  border-top: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--color-greyMedium);
}
.ss_foot span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
}
.ss_live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 手機:全幅 sheet,右上「取消」,不顯示按鍵小標與腳列 */
@media (max-width: 768px) {
  .ss_panel {
    inset: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  .ss_inrow .ss_esc,
  .ss_go,
  .ss_foot {
    display: none;
  }
  .ss_cancel {
    display: inline-flex;
    align-items: center;
  }
  .ss_opt {
    min-height: 44px;
  }
}
