/* ============================================================================
   EOH — Topbar search styles (v12.4.4)
   The search lives in the green top bar above the nav (replaces the old
   announcement-only topbar). The topbar shows rotating announcements on the
   left and a slim pill-shaped search input on the right.

   Layout:
   .topbar
   ├── .topbar__announcements   (left, rotating messages)
   └── .topbar__search          (right, search field + dropdown)
       ├── .topbar__search-icon
       ├── .topbar__search-input
       ├── .topbar__search-clear
       ├── .topbar__search-kbd   (the ⌘K hint)
       └── .topbar__search-results   (dropdown, anchored below the topbar)
   ============================================================================ */

/* ---- Topbar (replaces .announcement-bar) ---- */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  background: var(--ink, #2A7050);
  color: var(--cream, #FBF8F1);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(176, 139, 87, 0.3);
  height: 40px;
  padding: 0 12px;
  gap: 12px;
}

/* ---- Announcements on the left ---- */
.topbar__announcements {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.topbar__ann-item {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  height: 40px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.topbar__ann-item.is-active { opacity: 1; }
.topbar__ann-item strong { color: #B08B57; font-weight: 600; }
.topbar__ann-item em { font-style: normal; color: #B08B57; font-weight: 500; }

/* ---- Search field on the right ---- */
.topbar__search {
  position: relative;
  flex: 0 1 360px;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 30px;
  background: rgba(251, 248, 241, 0.95);
  border-radius: 999px;
  padding: 0 6px 0 32px;
  color: var(--ink, #1A1A1A);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.topbar__search:focus-within {
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(176, 139, 87, 0.5);
}
.topbar__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted, #6A6A6A);
  pointer-events: none;
  display: grid;
  place-items: center;
}
.topbar__search-icon svg { width: 100%; height: 100%; }
.topbar__search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.82rem;
  color: var(--ink, #1A1A1A);
  padding: 0;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.topbar__search-input::placeholder {
  color: var(--muted, #6A6A6A);
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.topbar__search-clear {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted, #6A6A6A);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0 2px 0 0;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.topbar__search-clear:hover {
  color: var(--ink, #1A1A1A);
  background: rgba(31, 58, 46, 0.08);
}
.topbar__search-clear[hidden] { display: none; }
.topbar__search-kbd {
  flex: 0 0 auto;
  display: none;  /* shown only on wider viewports via media query */
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid rgba(31, 58, 46, 0.2);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink, #1A1A1A);
  margin: 0 2px 0 0;
  line-height: 1.1;
}

/* ---- Results dropdown (anchored to top bar) ---- */
.topbar__search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 380px;
  max-width: min(480px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  background: white;
  border: 1px solid rgba(31, 58, 46, 0.12);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(31, 58, 46, 0.18);
  z-index: 250;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 58, 46, 0.2) transparent;
}
.topbar__search-results::-webkit-scrollbar { width: 6px; }
.topbar__search-results::-webkit-scrollbar-track { background: transparent; }
.topbar__search-results::-webkit-scrollbar-thumb { background: rgba(31, 58, 46, 0.2); border-radius: 3px; }

/* ---- Sections ---- */
.topbar__search-section { padding: 4px 0; }
.topbar__search-section + .topbar__search-section {
  border-top: 1px solid rgba(31, 58, 46, 0.08);
  margin-top: 4px;
  padding-top: 8px;
}
.topbar__search-section-title {
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted, #6A6A6A);
  padding: 6px 16px 4px;
}
.topbar__search-section-items { display: flex; flex-direction: column; }

/* ---- Result row ---- */
.topbar__search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--ink, #1A1A1A);
  border-left: 2px solid transparent;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.topbar__search-item:hover,
.topbar__search-item.is-active {
  background: rgba(31, 58, 46, 0.05);
  border-left-color: var(--gold-deep, #B08B57);
}

/* Kanji badge — colored per door */
.topbar__search-kanji {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-family: var(--serif-jp, 'Noto Serif JP', serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: white;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--ink, #1A1A1A);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.topbar__search-kanji--air     { background: linear-gradient(135deg, #8B5E2B 0%, #B08B57 100%); }
.topbar__search-kanji--bath    { background: linear-gradient(135deg, #4A5D3A 0%, #6B7F5A 100%); }
.topbar__search-kanji--skin    { background: linear-gradient(135deg, #A87A4F 0%, #C4A57B 100%); }
.topbar__search-kanji--inner   { background: linear-gradient(135deg, #1E5439 0%, #2A7050 100%); }
.topbar__search-kanji--collection {
  background: linear-gradient(135deg, #5B5BD6 0%, #2C2C7A 100%);
  font-size: 1rem;
}

/* Text block */
.topbar__search-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar__search-name {
  font-family: var(--serif, 'Cormorant Garamond', serif);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink, #1A1A1A);
}
.topbar__search-name .ja {
  font-size: 0.78em;
  color: var(--muted, #6A6A6A);
  margin-left: 4px;
  font-style: italic;
}
.topbar__search-sub {
  font-size: 0.74rem;
  color: var(--muted, #6A6A6A);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.topbar__search-flag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-deep, #B08B57);
}

/* Match highlight (text matched the query) */
.topbar__search-mark {
  background: rgba(176, 139, 87, 0.18);
  color: var(--ink, #1A1A1A);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}

/* Right column (price or "View") */
.topbar__search-price {
  font-family: var(--serif, 'Cormorant Garamond', serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink, #1A1A1A);
  flex-shrink: 0;
  white-space: nowrap;
}
.topbar__search-cta {
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gold-deep, #B08B57);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* ---- Empty state ---- */
.topbar__search-empty {
  padding: 18px 18px 14px;
  text-align: center;
  color: var(--muted, #6A6A6A);
}
.topbar__search-empty-title {
  font-family: var(--serif, 'Cormorant Garamond', serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink, #1A1A1A);
  margin-bottom: 4px;
}
.topbar__search-empty-sub {
  font-size: 0.78rem;
  font-style: italic;
  margin-bottom: 12px;
}
.topbar__search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}
.topbar__search-suggestion {
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 11px;
  border: 1px solid rgba(31, 58, 46, 0.15);
  border-radius: 999px;
  background: white;
  color: var(--ink, #1A1A1A);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.topbar__search-suggestion:hover {
  border-color: var(--gold-deep, #B08B57);
  background: var(--gold-deep, #B08B57);
  color: white;
}

/* ---- Footer (count + keyboard hints) ---- */
.topbar__search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(31, 58, 46, 0.08);
  font-size: 0.7rem;
  color: var(--muted, #6A6A6A);
}
.topbar__search-count {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.66rem;
}
.topbar__search-hints {
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted, #6A6A6A);
}
.topbar__search-hints kbd {
  display: inline-block;
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 5px;
  border: 1px solid rgba(31, 58, 46, 0.2);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: white;
  color: var(--ink, #1A1A1A);
  margin: 0 1px;
  line-height: 1.1;
}
.topbar__search-all {
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
  font-size: 0.72rem;
  color: var(--gold-deep, #B08B57);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  text-decoration: none;
}
.topbar__search-all:hover { text-decoration: underline; }

/* ---- Nav has a small ⌕ link (matches the topbar search visually) ---- */
.nav__search-link {
  display: none;  /* hidden on the smallest viewports */
  width: 32px; height: 32px;
  align-items: center;
  justify-content: center;
  color: var(--ink, #1A1A1A);
  opacity: 0.75;
  border-radius: 50%;
  transition: background 0.15s var(--ease), opacity 0.15s var(--ease);
}
.nav__search-link:hover {
  background: rgba(31, 58, 46, 0.08);
  opacity: 1;
}
.nav__search-link svg { width: 18px; height: 18px; }
.nav--dark .nav__search-link { color: var(--cream, #F1ECE2); }

/* ---- Responsive: topbar search width + visibility of ⌘K hint + nav link ---- */
@media (min-width: 1100px) {
  .topbar__search-kbd { display: inline-block; }
}
@media (min-width: 1280px) {
  .topbar__search { flex-basis: 420px; }
}
@media (min-width: 1500px) {
  .topbar__search { flex-basis: 480px; }
}
@media (min-width: 1750px) {
  .nav__search-link { display: inline-flex; }
}

/* ---- Push the nav down to account for the topbar (was 36px, now 40px) ---- */
body:has(.topbar) .nav { top: 40px; }
body:has(.topbar) .nav--scrolled { top: 0; }

/* ---- Mobile: hide announcements, search takes the full topbar ---- */
@media (max-width: 1100px) {
  .topbar { padding: 0 8px; }
  .topbar__announcements { display: none; }
  .topbar__search { flex-basis: 100%; }
  .topbar__search-kbd { display: none; }
  .nav__search-link { display: none; }
}
@media (max-width: 700px) {
  .topbar__search-input { font-size: 0.85rem; }
}

/* ---- Mobile menu keeps the search (from v12.4.3 fix) ---- */
.mobile-menu .topbar__search-wrap { display: block !important; }
.mobile-menu .topbar__search { display: block !important; height: 36px; width: 100%; flex-basis: auto; padding: 0 6px 0 32px; }
.mobile-menu .topbar__search-icon { left: 10px; }
.mobile-menu .topbar__search-input { width: 100%; font-size: 0.85rem; }
.mobile-menu .topbar__search-clear { right: 10px; }
.mobile-menu .topbar__search-results {
  position: static;
  min-width: 0;
  max-width: 100%;
  box-shadow: none;
  border: 0;
  background: transparent;
  padding: 0;
  max-height: none;
}

/* ---- Legacy compatibility for any element still expecting nav-search classes ---- */
.nav__search-wrap,
.nav__search-toggle,
.nav__search,
.nav__search-icon--inline,
.nav__search-input,
.nav__search-clear,
.nav__search-panel,
.nav__search-results,
.nav__search-section,
.nav__search-section-title,
.nav__search-section-items,
.nav__search-item,
.nav__search-kanji,
.nav__search-kanji--air,
.nav__search-kanji--bath,
.nav__search-kanji--skin,
.nav__search-kanji--inner,
.nav__search-kanji--collection,
.nav__search-text,
.nav__search-name,
.nav__search-sub,
.nav__search-flag,
.nav__search-mark,
.nav__search-price,
.nav__search-cta,
.nav__search-empty,
.nav__search-empty-title,
.nav__search-empty-sub,
.nav__search-suggestions,
.nav__search-suggestion,
.nav__search-footer,
.nav__search-count,
.nav__search-hints,
.nav__search-all,
.nav__search-wrap--collapsed,
.nav__search-wrap--expanded { display: none !important; }
