/* Advoke CV — Gallery Search Bar */

.gallery-search {
  position: sticky;
  top: var(--header-height-mobile);
  z-index: var(--z-sticky);
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border-subtle);
  padding-block: var(--space-3);
  transition: box-shadow var(--duration-base) var(--ease-out);
}

@media (min-width: 768px) {
  .gallery-search {
    top: var(--header-height);
    padding-block: var(--space-4);
  }
}

.gallery-search.is-stuck {
  box-shadow: var(--shadow-sm);
}

.gallery-search__inner {
  max-width: var(--container-2xl);
  margin-inline: auto;
  padding-inline: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .gallery-search__inner {
    padding-inline: var(--space-5);
  }
}

@media (min-width: 768px) {
  .gallery-search__inner {
    padding-inline: var(--space-6);
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
  }
}

@media (min-width: 1280px) {
  .gallery-search__inner {
    padding-inline: var(--space-8);
  }
}

.gallery-search__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.gallery-search__input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-10) var(--space-2) var(--space-10);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
  color: var(--color-text);
  background-color: var(--white);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.gallery-search__input::placeholder {
  color: var(--color-text-subtle);
}

.gallery-search__input:hover:not(:focus) {
  border-color: var(--color-text-muted);
}

.gallery-search__input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245, 184, 0, 0.2);
}

.gallery-search__icon {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.gallery-search__icon svg {
  width: 100%;
  height: 100%;
}

.gallery-search__clear {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--ink-100);
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  transition: var(--transition-colors);
}

.gallery-search__clear:hover {
  background-color: var(--ink-200);
  color: var(--color-text);
}

.gallery-search__clear:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

.gallery-search__clear svg {
  width: 14px;
  height: 14px;
}

.gallery-search__clear[hidden] {
  display: none;
}

.gallery-search__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.gallery-search__sort {
  min-height: 44px;
  padding: var(--space-2) var(--space-10) var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  background-color: var(--white);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: var(--transition-colors);
  white-space: nowrap;
}

.gallery-search__sort:hover {
  border-color: var(--color-accent);
}

.gallery-search__sort:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245, 184, 0, 0.2);
  outline: none;
}

.gallery-search__filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  background-color: var(--white);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-colors);
  position: relative;
  white-space: nowrap;
}

.gallery-search__filter-toggle:hover {
  border-color: var(--color-accent);
  background-color: var(--color-accent-tint);
}

.gallery-search__filter-toggle:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.gallery-search__filter-toggle svg {
  width: 16px;
  height: 16px;
}

.gallery-search__filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1-5);
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent-text);
  background-color: var(--color-accent);
  border-radius: var(--radius-full);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .gallery-search__filter-toggle {
    display: none;
  }
}

.gallery-search__results-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

@media (max-width: 767px) {
  .gallery-search__results-info {
    display: none;
  }
}

.gallery-search__results-count {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.gallery-search__suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--space-1);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.gallery-search__suggestions[data-open="true"] {
  display: block;
}

.gallery-search__suggestion {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-colors);
}

.gallery-search__suggestion:hover,
.gallery-search__suggestion.is-highlighted {
  background-color: var(--color-accent-tint);
}

.gallery-search__suggestion svg {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.gallery-search__suggestion-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-search__suggestion-type {
  font-size: var(--text-2xs);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-search,
  .gallery-search__input,
  .gallery-search__clear,
  .gallery-search__sort,
  .gallery-search__filter-toggle,
  .gallery-search__suggestion {
    transition: none;
  }
}