/* Header search box: the input, its suggestion dropdown, and the mobile
   collapse. Loaded after assets/app.css (scripts/build.js), so an equal
   specificity rule here wins without touching that file. Every color and
   radius below reads the same custom properties app.css defines on :root,
   so this never introduces a second palette (CLAUDE.md, Consistency).
   Nothing here changes .livehead's grid-template-columns at any width: the
   box sits inside .brand, the header's own "auto" column, which is already
   free to grow or shrink the flexible .livestate column beside it. */

.mon-search { display: flex; align-items: center; position: relative; min-width: 0; }
.mon-search-field { display: flex; align-items: center; gap: 8px; width: clamp(190px, 24vw, 340px); min-width: 0; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); background: var(--surface); transition: border-color 120ms var(--ease, ease); }
.mon-search-field:focus-within { border-color: var(--info, #5b7fd6); }
.mon-search-field svg { flex: none; color: var(--fg-3); }
.mon-search-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: 600 15px/1.3 var(--body); }
.mon-search-input::placeholder { color: var(--fg-3); font-weight: 500; }
.mon-search-input:focus { outline: none; }
.mon-search-clear { flex: none; display: none; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--fg-3); cursor: pointer; }
.mon-search-clear:hover { background: var(--tan-200); color: var(--fg); }
.mon-search-field.has-text .mon-search-clear { display: inline-flex; }
.mon-search-spin { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--fg-3); display: none; animation: mon-search-spin 700ms linear infinite; }
.mon-search-field.loading .mon-search-spin { display: inline-block; }
.mon-search-field.loading .mon-search-clear { display: none; }
@keyframes mon-search-spin { to { transform: rotate(360deg); } }

.livehead.over-hero:not(.solid) .mon-search-field { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.livehead.over-hero:not(.solid) .mon-search-input { color: #fff; }
.livehead.over-hero:not(.solid) .mon-search-field svg,
.livehead.over-hero:not(.solid) .mon-search-clear { color: rgba(255,255,255,.75); }
.livehead.over-hero:not(.solid) .mon-search-input::placeholder { color: rgba(255,255,255,.6); }

/* ---- suggestions dropdown, styled after .nav-panel's own pattern ---- */
.mon-search-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 90; max-height: min(70vh, 480px); overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-box, 12px); background: var(--surface); box-shadow: 0 12px 34px rgba(13, 19, 33, .18); display: none; }
html[data-theme="dark"] .mon-search-list { box-shadow: 0 12px 34px rgba(0, 0, 0, .5); }
.mon-search-field.open + .mon-search-list, .mon-search-list.open { display: block; }
.mon-search-group + .mon-search-group { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.mon-search-group-h { padding: 4px 8px 2px; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--fg-3); }
.mon-search-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 5px 8px; border: 0; border-radius: var(--r-ctl, 10px); background: transparent; color: var(--fg); font: 500 14px/1.3 var(--body); text-align: left; cursor: pointer; }
.mon-search-opt:hover, .mon-search-opt.active { background: var(--sub); }
.mon-search-opt-media { flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--tan-200); color: var(--fg-2); }
.mon-search-opt-media img { width: 100%; height: 100%; object-fit: cover; }
.mon-search-opt-media svg { width: 18px; height: 18px; }
.mon-search-opt .fav-mark { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font: 700 11px/1 var(--head); background: var(--tan-200); color: var(--fg-2); border-radius: 50%; }
.mon-search-opt-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-search-opt-n { flex: none; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: var(--fg-2); background: var(--sub); border-radius: var(--r-chip, 999px); padding: 3px 8px; }
.mon-search-adv-row { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 4px; padding: 5px 8px; border-top: 1px solid var(--line); border-radius: var(--r-ctl, 10px); font: 700 13px/1.2 var(--body); color: var(--link); text-decoration: none; }
.mon-search-adv-row svg { flex: none; }
.mon-search-adv-row span { line-height: 1; }
.mon-search-adv-row:hover { background: var(--sub); text-decoration: none; }
.mon-search-empty { padding: 10px 8px; font-size: 12.5px; color: var(--fg-3); }

/* ---- mobile: collapse to an icon that opens a full width overlay row ---- */
.mon-search-toggle { display: none; flex: none; align-items: center; justify-content: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: var(--r-ctl, 10px); background: var(--surface); color: var(--fg); cursor: pointer; }
.livehead.over-hero:not(.solid) .mon-search-toggle { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }

@media (max-width: 760px) {
  .mon-search-field { display: none; }
  .mon-search-toggle { display: inline-flex; }
  .mon-search.open .mon-search-toggle { display: none; }
  .mon-search.open .mon-search-field { display: flex; position: fixed; top: var(--livehead-h, 56px); left: 0; right: 0; width: auto; height: 56px; padding: 0 16px; border-radius: 0; border-width: 0 0 1px; z-index: 90; }
  .mon-search.open .mon-search-list { position: fixed; top: calc(var(--livehead-h, 56px) + 56px); left: 0; right: 0; border-radius: 0; border-width: 0 0 1px; max-height: calc(100vh - var(--livehead-h, 56px) - 56px); }
}
