/* Site header: dark top row, white menu bar, phone menu sheet. Phone layout below 900px. */

.site-header { position: relative; color: var(--on-dark); }

/* Top row */
.site-header__top { background: var(--dark); }

.site-header__top-inner {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-header__logo { display: flex; flex-shrink: 0; color: var(--on-dark); }
.site-header__logo:hover { color: var(--on-dark); }

/* Search */
.site-search { position: relative; flex: 1; max-width: 720px; margin: 0 auto; }

.site-search__box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 4px 0 16px;
  background: var(--surface);
  border-radius: var(--r-md);
}

.site-search__box:focus-within { box-shadow: 0 0 0 3px var(--brand); }
.site-search__icon { display: flex; color: var(--ink-3); }

.site-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
}

.site-search__key {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  padding: 2px 7px;
}

.site-search__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--cta);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.site-search__submit-icon { display: none; }

/* The search's panel (site.js): the sets that match, the themes beside them, a link to all results.
   A dropdown under the field on wide screens, the page dimmed behind it; full screen on phones (.is-full) */
.site-search__back, .site-search__clear { display: none; }

/* Scan a barcode (touch devices that can read them; site.js shows it) */
.site-search__scan:not([hidden]) {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink-2);
}

.site-search__scan:hover, .site-search__scan:focus-visible { background: var(--page); color: var(--ink); }

/* The camera, full screen, with a frame to hold the code in; the result slides up over it */
.scanner {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  border: 0;
  color: #fff;
}

.scanner[open] { display: flex; flex-direction: column; }
.scanner::backdrop { background: #000; }
.scanner__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 8px 10px 16px; background: var(--dark); }
.scanner__bar strong { font-size: 17px; }
.scanner__close { display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; background: none; border: 0; color: #fff; }

.scanner__view { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scanner__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.scanner__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(80vw, 340px);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -60%);
  border: 3px solid var(--brand);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}

.scanner__hint { position: absolute; right: 16px; bottom: 32px; left: 16px; margin: 0; font-size: 16px; font-weight: 700; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.scanner.has-result .scanner__hint, .scanner.has-result .scanner__frame { display: none; }

.scanner__result {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 75%;
  overflow: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--page);
  border-radius: 22px 22px 0 0;
  color: var(--ink);
}

.scanner__result[hidden] { display: none; }
.scanner__result p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.scanner__title { font-family: var(--font-display); font-size: 22px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.scanner__status { font-weight: 700; }
.scanner__hit, .scanner__hits li { background: var(--surface); border-radius: 14px; }
.scanner__hits { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.scanner__result .search-hit { flex-wrap: wrap; align-items: flex-start; gap: 0 12px; padding: 10px; }
.scanner__result .search-hit__title { display: -webkit-box; line-height: 1.3; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.scanner__result .search-hit__price { flex-direction: row; align-items: baseline; gap: 10px; margin-left: 76px; }
.scanner__actions { display: flex; flex-direction: column; gap: 8px; }
.scanner__btn { min-height: 50px; font-size: 16px; }
.scanner__btn:not(.btn--primary) { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); }

.site-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-areas: 'main side' 'foot foot';
  width: min(860px, calc(100vw - 32px));
  overflow: hidden;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--ink);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.site-search__panel[hidden] { display: none; }
.site-search.is-open { z-index: 56; }
body.search-open .site-header { z-index: 56; }
.search-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(42, 42, 42, 0.45); }

.search-panel__main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; max-height: min(62vh, 520px); overflow: auto; padding: 14px 10px 10px; }
.search-panel__head { display: flex; justify-content: space-between; padding: 4px 10px 8px; font-size: 13px; color: var(--ink-3); }
.search-panel__label { font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.search-panel__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.search-panel__list li { border-radius: 12px; }
.search-panel__list li[aria-selected="true"], .search-panel__list li:hover { background: var(--page); }

.search-hit { display: flex; align-items: center; gap: 14px; padding: 8px 10px; color: var(--ink); text-decoration: none; }
.search-hit:hover { color: var(--ink); }

.search-hit__thumb {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 52px;
  padding: 4px;
  background: var(--image-bg);
  border-radius: 10px;
}

.search-hit__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.search-hit__text { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.search-hit__title { overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.search-hit mark { padding: 0 1px; background: var(--red-tint); color: var(--cta); font-weight: 800; border-radius: 3px; }
.search-hit__meta { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.search-hit__stock { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.search-hit__bar { width: 56px; height: 6px; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line); }
.search-hit__price { display: flex; flex-shrink: 0; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; font-weight: 700; }
.search-hit__price strong { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--ink); }
.search-hit__price .search-hit__none { font-family: var(--font-body); font-size: 14px; color: var(--ink-3); }

.tone--good { color: var(--green); }
.tone--warn { color: var(--amber); }
.tone--bad { color: var(--cta); }
.tone--neutral, .tone--none { color: var(--ink-3); }

.search-panel__side { grid-area: side; display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface-2); border-left: 1px solid var(--line); }

.search-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.search-theme:hover { color: var(--cta); }
.search-theme span { flex-shrink: 0; font-weight: 500; color: var(--ink-3); }

.search-panel__foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.search-panel__all { font-size: 15px; font-weight: 800; color: var(--cta); text-decoration: none; }
.search-panel__all:hover { text-decoration: underline; }
.search-panel__keys { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.search-panel__keys kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 5px; font-family: inherit; }

.search-panel__none { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 20px; font-size: 15px; }
.search-panel__none a { font-weight: 700; color: var(--cta); text-decoration: none; }
.search-panel__recent { display: none; }
.search-panel__chips { display: flex; flex-wrap: wrap; gap: 6px; }

.search-chip {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

/* Wishlist, collection, log in */
.site-header__account { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.account-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--tap);
  padding: 0 12px;
  border-radius: 10px;
  color: var(--on-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.account-link:hover { color: var(--on-dark); background: rgba(255, 255, 255, 0.08); }
.account-link--login { width: var(--tap); padding: 0; justify-content: center; }

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.count[hidden] { display: none; }
.count--wish { background: var(--cta); }
.count--own { background: var(--ink-2); }

.site-header__menu-btn {
  display: none;
  width: var(--tap);
  height: var(--tap);
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--on-dark);
}

/* ☰ while closed, ✕ while open */
.site-header__menu-btn .site-header__menu-open { display: flex; }
.site-header__menu-btn .site-header__menu-close { display: none; }
.site-header__menu-btn[aria-expanded="true"] .site-header__menu-open { display: none; }
.site-header__menu-btn[aria-expanded="true"] .site-header__menu-close { display: flex; }

/* Menu bar */
.site-header__bar { background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }

.site-header__bar-inner {
  height: 46px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
}

.site-nav { display: flex; gap: 4px; }

.dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.dot--live { background: var(--lime); }

/* The holiday list in season, in light red */
.site-nav__season {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  margin-right: 6px;
  border-radius: var(--r-pill);
  background: var(--red-tint);
  color: var(--cta);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__season:hover { color: var(--cta); }

.site-nav__link {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link[aria-current="page"] { border-bottom-color: var(--brand); }

.site-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* The phone menu only exists on phones */
.site-menu { display: none; }

@media (max-width: 1199px) {
  .site-header__bar .site-status { display: none; }
}

/* ---------- Phones and small tablets ---------- */
@media (max-width: 899px) {
  .site-header__top-inner {
    height: auto;
    flex-wrap: wrap;
    gap: 0;
    padding: 0 8px 12px 16px;
  }

  .site-header__logo { order: 1; height: 56px; align-items: center; }
  .site-header__logo .logo { width: 117px; height: auto; }
  .site-header__account { order: 2; margin-left: auto; height: 56px; gap: 0; }
  .site-search { order: 3; flex: 1 1 100%; max-width: none; margin: 0 8px 0 0; }

  .site-search__box { height: 48px; padding: 0 4px 0 14px; gap: 8px; }
  .site-search__input { font-size: 16px; } /* 16px keeps iOS from zooming in */
  .site-search__key { display: none; }
  .site-search__submit { width: 40px; height: 40px; padding: 0; }
  .site-search__submit-label { display: none; }
  .site-search__submit-icon { display: flex; }

  /* Phones: the header's search full screen. The bar stays dark at the top; under it the themes, the sets, all results
     and the recent searches, scrolling on their own */
  body.search-full { overflow: hidden; }

  .site-search.is-full { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; margin: 0; background: var(--page); }
  .site-search.is-full .site-search__bar { display: flex; align-items: center; gap: 4px; padding: 8px 12px 12px 4px; background: var(--dark); }
  .site-search.is-full .site-search__back { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; background: none; border: 0; color: var(--on-dark); }
  .site-search.is-full .site-search__box { flex: 1; box-shadow: 0 0 0 3px var(--brand); }
  .site-search.is-full .site-search__clear:not([hidden]) { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: var(--line); border: 0; border-radius: 50%; color: var(--ink); }
  .site-search.is-full .site-search__submit { display: none; }

  .site-search.is-full .site-search__panel {
    position: static;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 18px;
    width: auto;
    overflow: auto;
    padding: 14px 16px 24px;
    transform: none;
    background: var(--page);
    border-radius: 0;
    box-shadow: none;
  }

  .site-search.is-full .search-panel__side { order: -1; flex-direction: row; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; background: none; border: 0; }
  .site-search.is-full .search-panel__side .search-panel__label { display: none; }
  .site-search.is-full .search-theme { flex-shrink: 0; gap: 6px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
  .site-search.is-full .search-panel__main { max-height: none; overflow: visible; padding: 0; }
  .site-search.is-full .search-panel__head { padding: 0 0 6px; }
  .site-search.is-full .search-panel__list { gap: 8px; }
  .site-search.is-full .search-panel__list li { background: var(--surface); border-radius: 14px; }
  .site-search.is-full .search-hit { flex-wrap: wrap; align-items: flex-start; gap: 0 12px; padding: 10px; }
  .site-search.is-full .search-hit__thumb { height: 56px; }
  .site-search.is-full .search-hit__title { display: -webkit-box; line-height: 1.3; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .site-search.is-full .search-hit__price { flex-direction: row; align-items: baseline; gap: 10px; margin-left: 76px; }
  .site-search.is-full .search-panel__foot { padding: 0; border: 0; }
  .site-search.is-full .search-panel__all { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; background: var(--cta); border-radius: 14px; color: #fff; font-size: 16px; }
  .site-search.is-full .search-panel__keys { display: none; }
  .site-search.is-full .search-panel__recent { display: flex; flex-direction: column; gap: 8px; }
  .site-search.is-full .search-panel__none { padding: 0; }

  .account-link { width: var(--tap); padding: 0; justify-content: center; }
  .account-link__label { display: none; }
  .account-link--login { display: none; }

  .account-link .count {
    position: absolute;
    top: 6px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 11px;
  }

  .site-header__menu-btn { display: flex; }

  /* The menu bar becomes a row of chips */
  .site-header__bar-inner {
    height: auto;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-header__bar-inner::-webkit-scrollbar { display: none; }
  .site-header__bar .site-status { display: none; }
  .site-header__bar--no-chips { display: none; }
  .site-nav { gap: 8px; }

  .site-nav__season {
    flex-shrink: 0;
    height: auto;
    min-height: 40px;
    padding: 0 16px;
    margin-right: 0;
    border: 1px solid var(--red-tint);
  }

  .site-nav__link {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
  }

  .site-nav__link[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

  /* The menu sheet */
  .site-menu:not([hidden]) {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    background: var(--page);
    color: var(--ink);
  }

  .site-menu__card { display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; overflow: hidden; }
  .site-menu__login { gap: 14px; padding: 18px; }
  .site-menu__login-head { display: flex; align-items: center; gap: 12px; }

  .site-menu__login-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--red-tint);
    color: var(--cta);
  }

  .site-menu__login-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .site-menu__login-text strong { font-size: 16px; }
  .site-menu__login-text span { font-size: 14px; line-height: 20px; color: var(--ink-3); }
  .site-menu__login-btn { min-height: 48px; font-size: 16px; font-weight: 800; }

  .site-menu__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 16px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
  }

  .site-menu__row + .site-menu__row { border-top: 1px solid var(--line-soft); }
  .site-menu__row-label { flex: 1; }
  .site-menu__row > svg { color: var(--ink-3); }
  .site-menu__row[aria-current="page"] { color: var(--cta); }
  .site-menu__row .count { min-width: 22px; height: 22px; padding: 0 7px; }

  .site-menu__row--season { gap: 10px; background: var(--red-tint-2); color: var(--cta); font-weight: 800; }
  .site-menu__row--season:hover { color: var(--cta); }

  .season-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: var(--r-pill);
    background: var(--red-tint);
    color: var(--cta);
    font-size: 12px;
    font-weight: 800;
  }

  .site-status--menu { padding: 4px 4px 0; }
}

/* Page scroll is locked while the phone menu is open */
body.menu-open { overflow: hidden; }
