/* ===========================================================
   Hearthside Picks — Smart Search
   Design tokens:
     Primary #1B4D3E | Accent #E8A838 | Text #1A1A2E
     Surface #FAFAF8 | Border #E5E7EB
     Heading: "DM Serif Display" | Body: "Source Sans 3"
   =========================================================== */

.hsp-search {
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1A1A2E;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}

/* ---- Form ---- */
.hsp-search__form {
  position: relative;
  margin: 0;
}

.hsp-search__label {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FAFAF8;
  border: 2px solid #1B4D3E;
  border-radius: 14px;
  padding: 6px 6px 6px 20px;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.hsp-search__label:focus-within {
  box-shadow: 0 0 0 4px rgba(27, 77, 62, 0.12);
}

.hsp-search__icon {
  color: #1B4D3E;
  flex-shrink: 0;
}

.hsp-search__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  color: #1A1A2E;
  font-family: inherit;
  padding: 14px 0;
  min-width: 0;
}
.hsp-search__input::placeholder {
  color: #1A1A2E;
  opacity: .5;
}

.hsp-search__submit {
  background: #1B4D3E;
  color: #FAFAF8;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  flex-shrink: 0;
}
.hsp-search__submit:hover {
  background: #E8A838;
  color: #1A1A2E;
}
.hsp-search__submit:active {
  transform: translateY(1px);
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

/* ---- Suggestions dropdown ---- */
.hsp-search__suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(26, 26, 46, 0.12);
  max-height: 520px;
  overflow-y: auto;
  z-index: 1000;
  padding: 8px;
}

.hsp-suggestion {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #1A1A2E;
  transition: background .12s ease;
  align-items: flex-start;
}
.hsp-suggestion:hover,
.hsp-suggestion.is-active {
  background: #FAFAF8;
}

.hsp-suggestion__thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #E5E7EB;
  flex-shrink: 0;
}
.hsp-suggestion__thumb--empty {
  background: linear-gradient(135deg, #FAFAF8, #E5E7EB);
}

.hsp-suggestion__body {
  flex: 1;
  min-width: 0;
}

.hsp-suggestion__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.hsp-badge {
  display: inline-block;
  color: #FAFAF8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 50px;
}

.hsp-suggestion__cat {
  font-size: 12px;
  color: #1A1A2E;
  opacity: .6;
}

.hsp-suggestion__title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 17px;
  line-height: 1.3;
  color: #1A1A2E;
  margin-bottom: 4px;
}

.hsp-suggestion__excerpt {
  font-size: 13px;
  color: #1A1A2E;
  opacity: .72;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hsp-suggestion mark,
.hsp-search__empty mark {
  background: rgba(232, 168, 56, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.hsp-search__viewall {
  display: block;
  text-align: center;
  padding: 14px;
  margin-top: 4px;
  border-top: 1px solid #E5E7EB;
  color: #1B4D3E;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0 0 10px 10px;
}
.hsp-search__viewall:hover {
  background: #FAFAF8;
}

.hsp-search__loading,
.hsp-search__empty,
.hsp-search__error {
  padding: 20px;
  text-align: center;
  color: #1A1A2E;
  opacity: .7;
  font-size: 14px;
}

/* ---- Category pills ---- */
.hsp-search__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.hsp-pill {
  background: #FAFAF8;
  border: 1px solid #E5E7EB;
  color: #1A1A2E;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
.hsp-pill:hover {
  border-color: #1B4D3E;
  color: #1B4D3E;
}
.hsp-pill.is-active {
  background: #1B4D3E;
  border-color: #1B4D3E;
  color: #FAFAF8;
}

/* ---- Popular tags ---- */
.hsp-search__popular {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.hsp-search__popular-label {
  font-size: 13px;
  color: #1A1A2E;
  opacity: .6;
  font-weight: 600;
}
.hsp-tag {
  background: transparent;
  border: 1px solid #E5E7EB;
  color: #1A1A2E;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .12s ease;
}
.hsp-tag:hover {
  background: #E8A838;
  border-color: #E8A838;
  color: #1A1A2E;
}

/* ===========================================================
   Variants
   =========================================================== */

/* Hero (homepage) */
.hsp-search--hero {
  padding: 8px 0;
}
.hsp-search--hero .hsp-search__input { font-size: 19px; padding: 18px 0; }
.hsp-search--hero .hsp-search__label { padding: 8px 8px 8px 24px; }
.hsp-search--hero .hsp-search__submit { padding: 14px 28px; font-size: 16px; }

/* Header (compact, sticky) */
.hsp-search--header {
  max-width: 480px;
}
.hsp-search--header .hsp-search__label {
  padding: 4px 4px 4px 16px;
  border-width: 1px;
}
.hsp-search--header .hsp-search__input { font-size: 15px; padding: 10px 0; }
.hsp-search--header .hsp-search__submit { padding: 9px 16px; font-size: 14px; }
.hsp-search--header .hsp-search__pills,
.hsp-search--header .hsp-search__popular { display: none; }

/* Inline (404, sidebar, search results page) */
.hsp-search--inline { max-width: 640px; }

/* Compact (minimal, no pills/popular) */
.hsp-search--compact .hsp-search__pills,
.hsp-search--compact .hsp-search__popular { display: none; }

/* ===========================================================
   Mobile
   =========================================================== */
@media (max-width: 640px) {
  .hsp-search__label {
    padding: 4px 4px 4px 16px;
  }
  .hsp-search__input { font-size: 16px; padding: 12px 0; }
  .hsp-search__submit { padding: 10px 16px; font-size: 14px; }
  .hsp-search--hero .hsp-search__input { font-size: 16px; padding: 14px 0; }
  .hsp-search--hero .hsp-search__submit { padding: 11px 18px; }

  .hsp-search__suggestions { max-height: 420px; }
  .hsp-suggestion__thumb { width: 56px; height: 56px; }
  .hsp-suggestion__title { font-size: 15px; }
  .hsp-suggestion__excerpt { font-size: 12px; -webkit-line-clamp: 2; }

  .hsp-search__pills { gap: 6px; }
  .hsp-pill { padding: 7px 14px; font-size: 13px; }

  .hsp-search__popular { font-size: 12px; }
}

/* ===========================================================
   Header search overlay (triggered by icon click)
   =========================================================== */
.hsp-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.hsp-search-overlay.is-open { display: flex; }
.hsp-search-overlay .hsp-search {
  background: #FAFAF8;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-width: 720px;
  width: calc(100% - 40px);
}
.hsp-search-overlay__close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: #FAFAF8;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  color: #1A1A2E;
}
