/* Shared TimTaj catalog search field. Page filter panels provide its context. */
.tt-catalog-search--filter {
  position: relative;
  display: block;
  box-sizing: border-box;
  flex: 0 0 clamp(188px, calc(25vw - 10px), 333px);
  min-width: 0;
  margin: 0;
}

.tt-catalog-search--filter input[type="search"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 0 58px 0 42px;
  border: 1px solid #dfe8f4;
  border-radius: 9px;
  background: #ffffff;
  color: var(--tt-color-text);
  font-family: inherit;
  font-size: 13px;
  box-shadow: none;
}

.tt-catalog-search--filter input[type="search"]::placeholder {
  color: var(--tt-color-muted);
  opacity: 1;
}

#qtBody .tt-catalog-search--filter input[type="search"]:focus:not([readonly]) {
  border-color: #dfe8f4;
  outline: 0;
  box-shadow: none;
}

.tt-catalog-search__submit {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tt-color-text);
  cursor: pointer;
  transform: translateY(-50%);
}
.tt-catalog-search__submit:not(:disabled) {
  color: var(--tt-color-primary);
}

.tt-catalog-search__submit:disabled {
  color: var(--tt-color-muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.tt-catalog-search__submit svg {
  display: block;
  width: 19px;
  height: 19px;
}

#qtBody .tt-catalog-search--filter .tt-catalog-search__reset {
  display: none;
  position: absolute;
  top: 50%;
  right: 12px;
  z-index: 2;
  color: var(--tt-color-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transform: translateY(-50%);
}

#qtBody .tt-catalog-search[data-has-active-filter="true"] .tt-catalog-search__reset {
  display: block;
}

#qtBody .tt-catalog-search--filter .tt-catalog-search__reset:hover,
#qtBody .tt-catalog-search--filter .tt-catalog-search__reset:focus-visible {
  color: var(--tt-color-primary-dark);
  text-decoration: underline;
}

/* Shared checkbox dropdown for reusable catalog archives. */
.tt-catalog-dropdown-filter {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  flex: 0 1 clamp(188px, calc(25vw - 10px), 333px);
  min-width: 0;
  margin: 0;
}

.tt-catalog-dropdown-filter:focus-within,
.tt-catalog-dropdown-filter:has(details[open]) {
  z-index: 60;
}

.tt-catalog-dropdown-filter details {
  position: relative;
  min-width: 0;
}

.tt-catalog-dropdown-filter summary {
  position: relative;
  display: flex;
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 0 62px 0 12px;
  border: 1px solid #dfe8f4;
  border-radius: 9px;
  background: #ffffff;
  color: var(--tt-color-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.3;
  list-style: none;
}

/* Keep the clear control beside the selected genre label. */
.tt-catalog-dropdown-filter details[data-has-selection="true"] > summary {
  padding-left: 36px;
}

.tt-catalog-dropdown-filter details[data-has-selection="true"] > summary > .tt-catalog-dropdown-filter__clear {
  left: 12px;
  right: auto;
}
.tt-catalog-dropdown-filter summary::-webkit-details-marker {
  display: none;
}

.tt-catalog-dropdown-filter summary::after {
  position: absolute;
  top: calc(50% - 4px);
  right: 15px;
  color: var(--tt-color-muted);
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 160ms ease, margin 160ms ease;
}

.tt-catalog-dropdown-filter details[open] > summary::after {
  transform: rotate(225deg);
}

.tt-catalog-dropdown-filter summary:focus-visible {
  border-color: #dfe8f4;
  outline: 0;
  box-shadow: none;
}

.tt-catalog-dropdown-filter__value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-catalog-dropdown-filter__clear {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 50%;
  right: 34px;
  z-index: 2;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tt-color-primary);
  font-size: 0;
  font-weight: 600;
  font-family: inherit;
  line-height: 0;
  cursor: pointer;
  transform: translateY(-50%);
}
.tt-catalog-dropdown-filter__clear::before,
.tt-catalog-dropdown-filter__clear::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.tt-catalog-dropdown-filter__clear::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tt-catalog-dropdown-filter__clear::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tt-catalog-dropdown-filter__clear:hover,
.tt-catalog-dropdown-filter__clear:focus-visible {
  background: var(--tt-color-primary-soft);
  color: var(--tt-color-primary-dark);
}

#qtBody .tt-catalog-dropdown-filter__menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 61;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: calc(100vw - 40px);
  max-height: min(340px, 55vh);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #d8e5f5;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

#qtBody .tt-catalog-dropdown-filter__menu label {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--tt-color-text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
}

.tt-catalog-dropdown-filter__menu label:hover {
  background: #f0f6ff;
}

.tt-catalog-dropdown-filter__menu input[type="checkbox"] {
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--tt-color-primary);
}

.tt-catalog-dropdown-filter__menu label > span {
  min-width: 0;
}

/* Shared Portfolio control layout. Field colors, type and states stay in this module. */
.tt-catalog-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.tt-catalog-search-controls--portfolio {
  grid-template-columns: minmax(250px, 1.65fr) minmax(0, 3fr);
  align-items: start;
  gap: 10px;
}

.tt-catalog-search-controls__facets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  overflow: visible;
}

.tt-catalog-search-controls--portfolio .tt-catalog-search--filter,
.tt-catalog-search-controls--portfolio .tt-catalog-dropdown-filter {
  width: 100%;
  max-width: none;
  flex: 0 1 auto;
  align-self: stretch;
}

@media (max-width: 767px) {
  /* Keep iOS from zooming the page when the search field receives focus. */
  .tt-catalog-search--filter input[type="search"] {
    font-size: 16px;
  }

  .tt-catalog-search-controls--portfolio {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .tt-catalog-search-controls__facets {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .tt-catalog-search--filter {
    width: calc(100% - 2px);
    max-width: 100%;
    flex: 0 0 auto;
    align-self: flex-start;
  }

  .tt-catalog-dropdown-filter {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    align-self: stretch;
  }
}

@media (min-width: 768px) and (max-width: 1200px) {
  .tt-catalog-search-controls--portfolio {
    grid-template-columns: minmax(190px, 1.1fr) minmax(0, 3fr);
    gap: 8px;
  }

  .tt-catalog-search-controls__facets {
    gap: 8px;
  }
}
