/* ==========================================================================
   Search: live search box, header search panel, search page, 404 page
   ========================================================================== */

/* Header search buttons
   ========================================================================== */

.search-open {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.search-open:hover,
.search-open:focus-visible {
  background-color: var(--gray-bg);
  border-color: var(--black);
}

.search-open.is-desktop {
  margin-right: 12px;
}

.search-open.is-mobile {
  display: none;
}

body.has-search-open {
  overflow: hidden;
}

/* Live search box
   ========================================================================== */

.live-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 6px 6px 6px 54px;
  color: var(--black);
  text-align: left;
  background-color: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.live-search:focus-within {
  border-color: var(--black);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08), 0 18px 40px rgba(0, 0, 0, 0.12);
}

.is-dark .live-search:focus-within {
  border-color: var(--white);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18), 0 18px 40px rgba(0, 0, 0, 0.4);
}

.live-search-icon {
  position: absolute;
  top: 50%;
  left: 20px;
  display: flex;
  opacity: 0.55;
  transform: translateY(-50%);
  pointer-events: none;
}

/* spinner replaces the icon while loading */
.live-search.is-loading .live-search-icon {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--black);
  border-radius: 50%;
  opacity: 1;
  animation: ls-spin 0.7s linear infinite;
}

.live-search.is-loading .live-search-icon img {
  display: none;
}

@keyframes ls-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.live-search-input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0;
  font: inherit;
  font-size: 18px;
  color: var(--black);
  background: transparent;
  border: 0;
  outline: 0;
}

.live-search-input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

/* hide the browser's own clear button, we have ours */
.live-search-input::-webkit-search-cancel-button {
  appearance: none;
}

.live-search-clear {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.5);
  background: transparent;
  border: 0;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.live-search-clear:hover {
  color: var(--black);
  background-color: var(--gray-bg);
}

.live-search .live-search-submit {
  flex-shrink: 0;
  height: 52px;
  padding: 0 28px;
  border-radius: 10px;
}

/* keep the submit button black, also inside black sections */
.is-dark .live-search .live-search-submit {
  color: var(--white);
  background-color: var(--black);
  border-color: var(--black);
}

.is-dark .live-search .live-search-submit:hover {
  background-color: var(--dark-hover);
  border-color: var(--dark-hover);
}

.live-search.is-md {
  max-width: none;
}

/* Suggestions panel */
.live-search-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  z-index: 30;
  overflow: hidden;
  background-color: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: ls-pop 0.16s ease-out;
}

@keyframes ls-pop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.live-search-list {
  max-height: min(60vh, 420px);
  padding: 8px;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.ls-group {
  padding: 10px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
}

.ls-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  color: var(--black);
  border-radius: 10px;
}

.is-active > .ls-item {
  background-color: var(--gray-bg);
}

.ls-thumb {
  display: block;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: cover;
  background: var(--gray-bg) url("../icons/ls-page.svg") no-repeat center / 20px;
  border-radius: 8px;
}

.ls-thumb-category {
  background-image: url("../icons/ls-category.svg");
}

.ls-thumb-recent {
  background-image: url("../icons/ls-recent.svg");
}

.ls-thumb-product {
  background-image: url("../icons/ls-category.svg");
}

.ls-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.ls-title {
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ls-title mark,
.search-item mark {
  padding: 0 1px;
  color: inherit;
  background-color: #ffe58a;
  border-radius: 3px;
}

.ls-meta {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.55);
}

.ls-arrow {
  color: rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, color 0.2s ease;
}

.is-active > .ls-item .ls-arrow {
  color: var(--black);
  transform: translateX(3px);
}

.ls-empty {
  padding: 18px 14px;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.6);
}

.live-search-all {
  display: block;
  padding: 14px 20px;
  font-size: 15px;
  color: var(--black);
  background-color: #fafafa;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.live-search-all:hover {
  background-color: var(--gray-bg);
}

/* Popular chips
   ========================================================================== */

.search-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.search-chips.is-center {
  justify-content: center;
}

.search-chips-label {
  font-size: 15px;
  opacity: 0.7;
}

.search-chip {
  padding: 7px 16px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.85;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.search-chip:hover,
.search-chip:focus-visible {
  color: var(--white);
  background-color: var(--black);
  border-color: var(--black);
  opacity: 1;
}

.is-dark .search-chip:hover,
.is-dark .search-chip:focus-visible,
.search-overlay .search-chip:hover {
  color: var(--black);
  background-color: var(--white);
  border-color: var(--white);
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin: 0 2px;
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  border: 1px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 5px;
  opacity: 0.7;
}

/* Header search panel
   ========================================================================== */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--gutter) var(--gutter);
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

.search-overlay-box {
  position: relative;
  width: 100%;
  max-width: 760px;
  color: var(--white);
  opacity: 0;
  transform: translateY(-16px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-overlay.is-open .search-overlay-backdrop,
.search-overlay.is-open .search-overlay-box {
  opacity: 1;
  transform: none;
}

.search-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.search-overlay-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
}

.search-overlay-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 26px;
  line-height: 1;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 10px;
  transition: background-color 0.2s ease;
}

.search-overlay-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.search-overlay .search-chips {
  color: var(--white);
}

.search-overlay-hint {
  margin-top: 18px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

/* Search page
   ========================================================================== */

.search-hero {
  padding: 80px 0 60px;
  text-align: center;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 60%);
}

.search-hero .tag {
  margin-bottom: 20px;
}

.search-hero-title {
  margin-bottom: 10px;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 400;
  line-height: 1.15;
  word-break: break-word;
}

.search-hero-count {
  margin-bottom: 30px;
  font-size: 18px;
  color: var(--text-muted);
}

.search-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.search-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.search-tab:hover {
  border-color: var(--white);
}

.search-tab.is-active {
  color: var(--black);
  background-color: var(--white);
  border-color: var(--white);
}

.search-tab-count {
  min-width: 24px;
  padding: 0 7px;
  font-size: 13px;
  line-height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.search-tab.is-active .search-tab-count {
  background: rgba(0, 0, 0, 0.08);
}

/* light background chosen for the search hero */
.is-light .search-tab {
  border-color: rgba(0, 0, 0, 0.2);
}

.is-light .search-tab.is-active {
  color: var(--white);
  background-color: var(--black);
}

.search-group + .search-group {
  margin-top: 60px;
}

.search-group[hidden] {
  display: none;
}

.search-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 28px;
  font-weight: 700;
}

.search-group-title span {
  padding: 2px 10px;
  font-size: 15px;
  font-weight: 600;
  background-color: var(--gray-bg);
  border-radius: 999px;
}

.search-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  color: var(--black);
  background-color: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-item:hover,
.search-item:focus-visible {
  border-color: var(--black);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.search-item-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.search-item-url {
  overflow: hidden;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-item-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.search-item-text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
}

.search-item-arrow {
  flex-shrink: 0;
  font-size: 22px;
  transition: transform 0.2s ease;
}

.search-item:hover .search-item-arrow {
  transform: translateX(4px);
}

.search-more-note {
  margin-top: 40px;
  font-size: 16px;
  color: var(--text-muted);
  text-align: center;
}

/* Empty state */
.search-empty {
  max-width: 640px;
  margin: 0 auto 70px;
  text-align: center;
}

.search-empty-art {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}

.search-empty-lens {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 78px;
  height: 78px;
  border: 8px solid var(--black);
  border-radius: 50%;
  animation: search-wobble 3.2s ease-in-out infinite;
}

.search-empty-handle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 38px;
  height: 10px;
  background-color: var(--black);
  border-radius: 6px;
  transform: rotate(45deg);
  transform-origin: center;
}

@keyframes search-wobble {
  0%,
  100% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(6px, -3px);
  }

  50% {
    transform: translate(0, 4px);
  }

  75% {
    transform: translate(-6px, -2px);
  }
}

.search-empty-title {
  margin-bottom: 16px;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  word-break: break-word;
}

.search-tips {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--text-muted);
  text-align: left;
}

/* 404 page
   ========================================================================== */

.error-hero {
  --spot-x: 50%;
  --spot-y: 30%;
  position: relative;
  z-index: 2; /* suggestions list can hang over the next section */
  padding: 90px 0 100px;
  text-align: center;
}

.error-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 70%);
  pointer-events: none;
}

.error-hero-spot {
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--spot-x) var(--spot-y), rgba(255, 255, 255, 0.11), transparent 70%);
  pointer-events: none;
}

.is-light .error-hero-grid {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
}

.is-light .error-hero-spot {
  background: radial-gradient(420px circle at var(--spot-x) var(--spot-y), rgba(0, 0, 0, 0.06), transparent 70%);
}

.error-hero-inner {
  position: relative;
  max-width: 900px;
}

.error-code {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 22px);
  margin-bottom: 26px;
  font-family: var(--font-accent);
  font-size: clamp(110px, 18vw, 230px);
  line-height: 1;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.25s ease-out;
}

.error-digit {
  display: block;
  color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.55) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.is-light .error-digit {
  background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0.55) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* the "0": a dashed ring with an eye that follows the cursor */
.error-zero {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.72em;
  height: 0.9em;
}

.error-ring {
  position: absolute;
  inset: 0;
  border: 0.07em dashed currentColor;
  border-radius: 50%;
  opacity: 0.85;
  animation: error-spin 24s linear infinite;
}

@keyframes error-spin {
  to {
    transform: rotate(360deg);
  }
}

.error-eye {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.4em;
  height: 0.4em;
  overflow: hidden;
  background-color: currentColor;
  border-radius: 50%;
  transition: height 0.12s ease;
}

.error-eye.is-blinking {
  height: 0.03em;
}

.error-pupil {
  --px: 0px;
  --py: 0px;
  width: 0.16em;
  height: 0.16em;
  background-color: var(--black);
  border-radius: 50%;
  transform: translate(var(--px), var(--py));
  transition: transform 0.12s ease-out;
}

.is-light .error-pupil {
  background-color: var(--white);
}

.error-kicker {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

.error-title {
  margin-bottom: 14px;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 400;
  line-height: 1.15;
}

.error-text {
  max-width: 620px;
  margin: 0 auto 34px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-muted);
}

.error-guess {
  max-width: 760px;
  padding: 18px;
  margin: 0 auto 26px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
}

.is-light .error-guess {
  background: var(--white);
  border-color: var(--border);
}

.error-guess-label {
  margin: 2px 6px 10px;
  font-size: 15px;
  font-weight: 600;
}

.error-guess-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.error-guess-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: background-color 0.2s ease;
}

.error-guess-link:hover,
.error-guess-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.is-light .error-guess-link:hover {
  background: var(--gray-bg);
}

.error-guess-type {
  flex-shrink: 0;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.7;
}

.error-guess-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

.error-guess-arrow {
  transition: transform 0.2s ease;
}

.error-guess-link:hover .error-guess-arrow {
  transform: translateX(4px);
}

.error-search {
  margin-bottom: 30px;
}

.error-actions {
  align-items: center;
}

.error-back {
  padding: 10px 6px;
  font-size: 17px;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  opacity: 0.8;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.error-back:hover {
  border-bottom-color: currentColor;
  opacity: 1;
}

.error-products .catalog-more {
  margin-top: 10px;
}

/* Motion off when the visitor asks for it */
@media (prefers-reduced-motion: reduce) {
  .error-ring,
  .search-empty-lens,
  .live-search.is-loading .live-search-icon {
    animation: none;
  }

  .error-code,
  .error-pupil,
  .search-overlay-box,
  .search-overlay-backdrop {
    transition: none;
  }
}

/* Responsive
   ========================================================================== */

@media (max-width: 991.98px) {
  .search-open.is-desktop {
    display: none;
  }

  .search-open.is-mobile {
    display: inline-flex;
    width: 44px;
    height: 44px;
    margin-left: auto;
    margin-right: 10px;
  }
}

@media (max-width: 767.98px) {
  .live-search {
    flex-wrap: wrap;
    padding: 6px 6px 6px 46px;
  }

  .live-search-icon {
    top: 32px;
    left: 16px;
  }

  .live-search-input {
    flex-basis: calc(100% - 50px);
    font-size: 16px;
  }

  /* full width under the input: pull back over the icon padding */
  .live-search .live-search-submit {
    flex-basis: calc(100% + 40px);
    margin-left: -40px;
  }

  .search-overlay {
    padding-top: 8vh;
  }

  .search-overlay-hint {
    display: none;
  }

  .search-hero,
  .error-hero {
    padding: 56px 0 64px;
  }

  .search-item {
    padding: 18px;
  }

  .search-item-title {
    font-size: 19px;
  }

  .error-guess-type {
    display: none;
  }
}
