/* ============================================================
   CRE42 SEARCH WIDGET
   Palette matched to cre42:
     MIT Cardinal    #A31F34
     Cardinal hover  #8B1A2E
     MIT Blue        #1A5276
     Light bg        #FAF5F5
   All selectors prefixed with .cre42- to avoid collisions
   with the existing styles.css.
   ============================================================ */

.cre42-search {
  position: relative;
  margin: 6px 0 0 0;
  width: 100%;
  max-width: 360px;
  font-family: inherit;
}

.cre42-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 12px;
  border: 1.5px solid #cfcfcf;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.3;
  background: #fff;
  color: #2c2c2c;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cre42-search-input::placeholder {
  color: #888;
  font-style: italic;
}

.cre42-search-input:focus {
  outline: none;
  border-color: #A31F34;
  box-shadow: 0 0 0 3px rgba(163, 31, 52, 0.15);
}

.cre42-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: none;
}

.cre42-search-results.open {
  display: block;
}

.cre42-search-result {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: #2c2c2c;
  cursor: pointer;
  transition: background 0.1s;
}

.cre42-search-result:last-child {
  border-bottom: none;
}

.cre42-search-result:hover,
.cre42-search-result.active {
  background: #FAF5F5;
}

.cre42-search-result-title {
  font-weight: 700;
  color: #A31F34;
  font-size: 14px;
  line-height: 1.3;
  margin: 0 0 2px 0;
}

.cre42-search-result-url {
  font-size: 11px;
  color: #888;
  margin: 0 0 4px 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.cre42-search-result-snippet {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cre42-search-result mark {
  background: #FFE9C2;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* "Did you mean" banner — shown when a typo'd query was auto-corrected. */
.cre42-search-didyoumean {
  padding: 9px 14px;
  font-size: 12px;
  color: #555;
  background: #faf6f0;
  border-bottom: 1px solid #f0e8dc;
}

.cre42-search-didyoumean strong {
  color: #A31F34;
  font-weight: 600;
}

.cre42-search-empty,
.cre42-search-loading,
.cre42-search-error {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: #777;
  font-style: italic;
}

.cre42-search-error {
  color: #A31F34;
  font-style: normal;
}

.cre42-search-footer {
  padding: 8px 14px;
  font-size: 11px;
  color: #888;
  text-align: center;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.cre42-search-scope-toggle {
  color: #A31F34;
  text-decoration: none;
  font-weight: 600;
}

.cre42-search-scope-toggle:hover,
.cre42-search-scope-toggle:focus {
  color: #8B1A2E;
  text-decoration: underline;
}

/* Controls row sits above the input. Holds the scope chip on section pages
   and the section <select> on the homepage. Hidden when empty. */
.cre42-search-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.cre42-search-controls:empty {
  display: none;
}

.cre42-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px 3px 10px;
  background: #fff;
  color: #A31F34;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.cre42-search-chip-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #A31F34;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
}

.cre42-search-chip-close:hover,
.cre42-search-chip-close:focus {
  background: #f3e7e9;
  opacity: 1;
  outline: none;
}

/* Match the site's own topic picker: white rounded control on the cardinal
   header, custom chevron (native select arrow is unstylable and reads
   generic against Chip's design). */
.cre42-search-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 28px 5px 12px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23A31F34' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #2c2c2c;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cre42-search-picker:hover {
  border-color: rgba(163, 31, 52, 0.45);
}

.cre42-search-picker:focus {
  outline: none;
  border-color: #A31F34;
  box-shadow: 0 0 0 3px rgba(163, 31, 52, 0.18);
}

.cre42-search-picker-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Proprietary content: surfaced in results with a small uppercase tag.
   Restrained typography — no icon, no emoji, just a labeled marker that
   reads as metadata. Title stays the visual anchor; the tag sits beside it. */
.cre42-search-result-locked .cre42-search-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cre42-search-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #c9bdc0;
  border-radius: 2px;
  color: #8B6770;
  background: transparent;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Mobile: full-width search, results dropdown spans the row */
@media (max-width: 700px) {
  .cre42-search {
    max-width: 100%;
  }
  .cre42-search-results {
    max-height: 60vh;
  }
}
