/* ============================================================
   search.css — Search results page styles
   Self-contained: includes search-bar base styles (extracted from home.css)
   ============================================================ */

/* ── Full-width override for search page ────────────────────── */
[data-page="search"] .container {
  max-width: 100%;
  padding-inline: var(--sp-6, 1.5rem);
}

@media (min-width: 1400px) {
  [data-page="search"] .container {
    padding-inline: var(--sp-8, 2rem);
  }
}

/* ── Search page header ─────────────────────────────────────── */
.search-page-header {
  background: var(--color-surface, #12121a);
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06));
  padding: var(--sp-5, 1.25rem) 0;
  position: sticky;
  top: 60px; /* below .site-header (60 px) */
  z-index: 100;
}

/* Subtle gradient glow behind search bar */
.search-page-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 60%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.4), transparent);
  pointer-events: none;
}

.search-page-header .container {
  max-width: 100%;
}

.search-page-header .search-bar {
  max-width: 860px;
  margin: 0 auto;
}

/* ── Modernized search bar for search page ──────────────────── */
.search-page-header .search-bar__form {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.08),
    0 4px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-page-header .search-bar__form:focus-within {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.15),
    0 0 30px rgba(139, 92, 246, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-page-header .search-bar__input {
  color: var(--color-text, #e4e4e7);
}

.search-page-header .search-bar__input::placeholder {
  color: var(--color-text-muted, #71717a);
}

.search-page-header .search-bar__icon {
  color: var(--color-text-muted, #71717a);
}

.search-page-header .search-bar__image-action {
  color: var(--color-text-muted, #71717a);
  border-inline-start-color: rgba(255, 255, 255, 0.08);
}

.search-page-header .search-bar__image-action:hover {
  color: var(--color-primary, #8b5cf6);
}

.search-page-header .search-bar__filter-btn {
  color: var(--color-text-muted, #71717a);
  border-inline-start-color: rgba(255, 255, 255, 0.08);
}

.search-page-header .search-bar__filter-btn:hover {
  color: var(--color-primary, #8b5cf6);
}

.search-page-header .search-bar__submit {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6 60%, #a78bfa);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.search-page-header .search-bar__submit:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
}

/* Light mode overrides for search bar */
[data-theme="light"] .search-page-header .search-bar__form {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(139, 92, 246, 0.15);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.06),
    0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .search-page-header .search-bar__form:focus-within {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.12),
    0 0 20px rgba(139, 92, 246, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .search-page-header .search-bar__input {
  color: #18181b;
}

[data-theme="light"] .search-page-header .search-bar__input::placeholder {
  color: #71717a;
}

[data-theme="light"] .search-page-header .search-bar__image-action,
[data-theme="light"] .search-page-header .search-bar__filter-btn {
  color: #71717a;
  border-inline-start-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .search-page-header .search-bar__image-action:hover,
[data-theme="light"] .search-page-header .search-bar__filter-btn:hover {
  color: #7c3aed;
}

/* ── Results bar ────────────────────────────────────────────── */
.search-results-bar {
  padding: var(--sp-3, 0.75rem) 0;
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06));
  background: transparent;
}

.search-results-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3, 0.75rem);
}

.search-results-bar__title {
  font-size: 1.8rem;
  font-weight: 650;
  color: var(--color-text, #e4e4e7);
  min-width: 0; /* shrink instead of pushing the sort-by control out / wrapping it left */
}

.search-results-bar__title--browse {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted, #71717a);
}

.search-results-bar__title em {
  font-style: normal;
  font-weight: 600;
  color: var(--color-text, #e4e4e7);
}

.search-results-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
  flex-wrap: wrap;
  margin-inline-start: auto; /* always pin to the right, even when the title wraps */
  flex-shrink: 0;
}

/* Active filter badges */
.active-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--color-primary, #8b5cf6);
  font-size: 0.8rem;
  font-weight: 500;
}

.active-filter-badge__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Filters toggle button */
.filters-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
}

/* ── Search layout: single-column (filters are now a left-slide modal) ── */
.search-layout {
  display: block;
  padding-top: var(--sp-6, 1.5rem);
  padding-bottom: var(--sp-12, 3rem);
}

/* ── Main results area ──────────────────────────────────────── */
.search-main {
  min-width: 0;
}

/* ── Masonry grid (CSS-grid fallback + JS-enhanced columns) ────── */
/* Default: CSS grid so layout is always usable before JS runs.   */
/* Masonry grid — flex from the start so adding .masonry--ready causes zero layout shift. */
.masonry-grid {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
/* Override home.css column-count (unused on search page) */
@media (min-width: 640px)  { .masonry-grid { column-count: auto; } }
@media (min-width: 1024px) { .masonry-grid { column-count: auto; } }

/* Responsive flex-wrap before AND after masonry.js adds .masonry--ready */
@media (max-width: 480px) {
  .masonry-grid { flex-wrap: wrap; }
  .masonry-grid > .masonry-column { flex: 0 0 100%; }
}
@media (min-width: 481px) and (max-width: 900px) {
  .masonry-grid { flex-wrap: wrap; }
  .masonry-grid > .masonry-column { flex: 0 0 calc(50% - 0.375rem); }
}

/* .masonry--ready: re-declares same values → no visual change, no CLS */
.masonry-grid.masonry--ready {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.masonry-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

/* Batch wrappers are consumed by masonry.js */
.masonry-batch {
  display: contents;
}

.masonry-batch .photo-card,
.masonry-column .photo-card {
  width: 100%;
}

/* ── Photo cards ────────────────────────────────────────────── */
.photo-card {
  break-inside: avoid;
  margin-bottom: 0;
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  background: var(--color-surface, #12121a);
  position: relative;
  cursor: pointer;
  contain: layout style;
}

@media (prefers-reduced-motion: no-preference) {
  .photo-card {
    transition: transform 220ms ease;
    will-change: transform;
  }
}

.photo-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(139, 92, 246, 0.15);
}

.photo-card__link {
  display: block;
  position: relative;
}

.photo-card__img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

@media (prefers-reduced-motion: no-preference) {
  .photo-card:hover .photo-card__img {
    transform: scale(1.02);
  }
}

/* Overlay */
.photo-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 55%);
  opacity: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--sp-3, 0.75rem);
}

.photo-card:hover .photo-card__overlay {
  opacity: 1;
}

.photo-card__photographer {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.photo-card__source {
  font-size: 0.7rem;
  text-transform: capitalize;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.8);
  padding: 2px 8px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Relevance dot ─────────────────────────────── */
.photo-card__relevance-dot {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  /* default color set by JS via --dot-color */
  background: var(--dot-color, #888);
  box-shadow: 0 0 6px 2px var(--dot-color, #888);
  pointer-events: auto;
  cursor: default;
}
.photo-card__relevance-dot:hover {
  transform: scale(1.5);
}

/* ── Skeleton loading cards ─────────────────────────────────── */
.photo-card-skeleton {
  break-inside: avoid;
  margin-bottom: 0;
  border-radius: var(--radius-lg, 12px);
  background: linear-gradient(90deg,
    var(--color-surface, #12121a) 25%,
    rgba(255,255,255,0.04) 50%,
    var(--color-surface, #12121a) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ────────────────────────────────────────────── */
.search-empty {
  text-align: center;
  padding: var(--sp-16, 4rem) var(--sp-8, 2rem);
  color: var(--color-text-muted, #71717a);
  max-width: 440px;
  margin: 0 auto;
}

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

.search-empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 0 auto var(--sp-6, 1.5rem);
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.08);
  color: var(--color-primary, #8b5cf6);
  opacity: 0.7;
}

.search-empty__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text, #e4e4e7);
  margin-bottom: var(--sp-2, 0.5rem);
}

.search-empty__text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: var(--sp-6, 1.5rem);
  color: var(--color-text-muted, #71717a);
}

/* ── Infinite scroll sentinel & spinner ─────────────────────── */
.scroll-sentinel {
  height: 1px;
  visibility: hidden;
}

.scroll-sentinel.is-hidden {
  display: none;
}

.search-spinner {
  display: flex;
  justify-content: center;
  padding: var(--sp-8, 2rem) 0;
}

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

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border, rgba(255,255,255,0.06));
  border-top-color: var(--color-primary, #8b5cf6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Load error state ───────────────────────────────────────── */
.search-load-error {
  text-align: center;
  padding: var(--sp-6, 1.5rem);
  color: var(--color-text-muted, #71717a);
}

.search-load-error p {
  margin-bottom: var(--sp-3, 0.75rem);
}

/* ── Filters panel (centered modal on all screen sizes) ────── */
.filters-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 520px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(18, 18, 26, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease, transform 250ms ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(139, 92, 246, 0.08);
  z-index: 520;
}

.filters-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

[data-theme="light"] .filters-panel {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(139, 92, 246, 0.15);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(139, 92, 246, 0.06);
}

.filters-panel__inner {
  padding: var(--sp-6, 1.5rem);
}

.filters-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6, 1.5rem);
}

.filters-panel__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text, #e4e4e7);
}

.filters-panel__close {
  display: flex; /* always visible in modal mode */
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted, #71717a);
  padding: 4px;
  border-radius: var(--radius-md, 8px);
  line-height: 1;
}

.filters-panel__close:hover {
  color: var(--color-text, #e4e4e7);
  background: rgba(255,255,255,0.05);
}

/* Backdrop — always available */
.filters-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 510;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.filters-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Filter sections ───────────────────────────────── */
.filters-section {
  margin-bottom: var(--sp-6, 1.5rem);
  padding-bottom: var(--sp-6, 1.5rem);
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06));
}

.filters-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.filters-section__heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted, #71717a);
  margin-bottom: var(--sp-4, 1rem);
}

/* Color swatches */
.filters-color-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: var(--sp-3, 0.75rem);
}

/* Also used in color_picker.html swatch panel */
.cp__swatch-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  justify-items: center;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  max-width: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  background-clip: padding-box;
  outline: none;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.is-active {
  border-color: var(--color-primary, #8b5cf6);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.3);
}

.filters-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--color-text-muted, #71717a);
  margin-top: var(--sp-2, 0.5rem);
}

.filters-active-tag__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted, #71717a);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}

.filters-active-tag__remove:hover {
  color: var(--color-error, #ef4444);
}

/* Orientation buttons */
.filters-orientation {
  display: flex;
  gap: var(--sp-2, 0.5rem);
}

.orient-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-3, 0.75rem) var(--sp-2, 0.5rem);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  color: var(--color-text-muted, #71717a);
  font-size: 0.75rem;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.orient-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e4e4e7);
}

.orient-btn.is-active {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.4);
  color: var(--color-primary, #8b5cf6);
}

.orient-btn__label {
  font-weight: 500;
}

/* Source checkboxes */
.filters-source-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3, 0.75rem);
}

.filters-checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-3, 0.75rem);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text, #e4e4e7);
}

.filters-checkbox input[type="checkbox"] {
  /* Hide native checkbox */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.filters-checkbox__mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  position: relative;
  transition: background 150ms ease, border-color 150ms ease;
}

.filters-checkbox input:checked ~ .filters-checkbox__mark {
  background: var(--color-primary, #8b5cf6);
  border-color: var(--color-primary, #8b5cf6);
}

.filters-checkbox input:checked ~ .filters-checkbox__mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpolyline points='2,6 5,9 10,3' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}

.filters-checkbox__label {
  flex: 1;
}

.filters-badge {
  font-size: 0.72rem;
  color: var(--color-text-muted, #71717a);
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 99px;
  margin-inline-start: auto;
}

/* Filter actions */
.filters-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 0.5rem);
  margin-top: var(--sp-6, 1.5rem);
}

.filters-apply {
  width: 100%;
  justify-content: center;
}

.filters-clear {
  width: 100%;
  justify-content: center;
  color: var(--color-text-muted, #71717a);
  font-size: 0.88rem;
}

/* ── Mobile: compact sizing for the filter panel content ──── */
@media (max-width: 640px) {
  .filters-panel__inner {
    padding: var(--sp-4, 1rem);
  }

  .filters-section {
    margin-bottom: var(--sp-4, 1rem);
    padding-bottom: var(--sp-4, 1rem);
  }

  .filters-section__heading {
    margin-bottom: var(--sp-3, 0.75rem);
  }

  .cp__tabs {
    margin-bottom: 0.75rem;
  }

  .cp__tab {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .orient-btn {
    padding: var(--sp-2, 0.5rem) var(--sp-2, 0.5rem);
    gap: 4px;
    font-size: 0.7rem;
  }

  .orient-btn svg {
    width: 20px;
    height: 20px;
  }

  .sf-toggle {
    padding: 6px 4px;
  }

  .sf-toggle__name {
    font-size: 0.85rem;
  }

  .filters-actions {
    margin-top: var(--sp-4, 1rem);
  }
}

/* ── btn-sm utility (not in main.css) ────────────────────────── */
.btn-sm {
  padding: var(--sp-2, 0.5rem) var(--sp-4, 1rem);
  font-size: 0.85rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   PROMPT 14 — Advanced filter components
   ───────────────────────────────────────────────────────────────────────── */

/* ── Filters panel: mobile drag handle (hidden in left-slide mode) ──── */
.filters-panel__handle {
  display: none;
}

/* ── Filters panel: count badge beside title ────────────────────────────── */
.filters-panel__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary, #8b5cf6);
  margin-inline-start: 6px;
}

/* ── Filters toggle: counter in button ──────────────────────────────────── */
.filters-toggle__count {
  font-weight: 600;
  color: var(--color-primary, #8b5cf6);
  font-size: 0.82rem;
}

/* Prevent body scroll when mobile drawer is open */
body.filters-open {
  overflow: hidden;
}

/* ── Active filters bar ─────────────────────────────────────────────────── */
.active-filters-bar {
  background: rgba(139, 92, 246, 0.06);
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
  padding: 0.5rem 0;
}

.active-filters-bar__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.active-filters-bar__label {
  font-size: 0.78rem;
  color: var(--color-text-muted, #71717a);
  white-space: nowrap;
  flex-shrink: 0;
}

.active-filters-bar__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.active-filters-bar__clear-all {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--color-text-muted, #71717a);
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 150ms, color 150ms;
}

.active-filters-bar__clear-all:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text, #e4e4e7);
}

/* Active filter chip (badge with × button) */
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--color-primary, #8b5cf6);
  font-size: 0.8rem;
  animation: chip-in 160ms ease;
}

@keyframes chip-in {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

.active-filter-chip__label {
  font-weight: 500;
}

.active-filter-chip__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary, #8b5cf6);
  font-size: 0.72rem;
  line-height: 1;
  padding: 1px 2px;
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 150ms, background 150ms;
}

.active-filter-chip__remove:hover {
  opacity: 1;
  background: rgba(139, 92, 246, 0.2);
}

/* ── Orientation button: count sub-text ─────────────────────────────────── */
.orient-btn__count {
  font-size: 0.68rem;
  color: var(--color-text-muted, #71717a);
  font-weight: 400;
}

/* ── License buttons ────────────────────────────────────────────────────── */
.filters-license {
  display: flex;
  gap: var(--sp-2, 0.5rem);
  flex-wrap: wrap;
}

.license-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--sp-3, 0.75rem) var(--sp-2, 0.5rem);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  color: var(--color-text-muted, #71717a);
  font-size: 0.75rem;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.license-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e4e4e7);
}

.license-btn.is-active {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.4);
  color: var(--color-primary, #8b5cf6);
}

.license-btn__label {
  font-weight: 500;
}

.license-btn__count {
  font-size: 0.68rem;
  color: var(--color-text-muted, #71717a);
  font-weight: 400;
}

/* ── Color picker (cp) component ────────────────────────────────────────── */
.cp__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.85rem;
}

.cp__tab {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted, #71717a);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}

.cp__tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text, #e4e4e7);
}

.cp__tab--active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.4);
  color: var(--color-primary, #8b5cf6);
}

.cp__tab:focus-visible {
  outline: 2px solid var(--color-primary, #8b5cf6);
  outline-offset: 2px;
}

.cp__panel--hidden {
  display: none;
}

/* Swatch grid (same as .filters-color-grid) */
.cp__swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 0.75rem;
}

/* Mobile: swatches plus petits (6 colonnes, taille fixe, centrés) — doit venir APRÈS la règle de base */
@media (max-width: 900px) {
  .filters-color-grid,
  .cp__swatch-grid {
    grid-template-columns: repeat(6, minmax(0, 44px));
    justify-content: center;
    gap: 8px;
  }
}

.cp__empty {
  font-size: 0.82rem;
  color: var(--color-text-muted, #71717a);
}

/* Hex panel */
.cp__hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.9rem;
}

.cp__hex-preview {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  transition: background 200ms;
}

.cp__hex-native {
  width: 34px;
  height: 30px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.cp__hex-text {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  color: var(--color-text, #e4e4e7);
  padding: 5px 9px;
  font-size: 0.82rem;
  font-family: ui-monospace, monospace;
  transition: border-color 150ms;
}

.cp__hex-text:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
}

.cp__tolerance-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 6px;
}

.cp__tolerance-label {
  font-size: 0.78rem;
  color: var(--color-text-muted, #71717a);
}

.cp__tolerance-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: help;
  color: var(--color-text-muted, #71717a);
  opacity: 0.6;
  transition: opacity 180ms;
  position: relative;
}
.cp__tolerance-info:hover {
  opacity: 1;
}

/* ── Modern tooltip (data-tooltip attr) ──── */
.cp__tolerance-info[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: translateY(4px);
  width: max-content;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  color: #fff;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
  z-index: 10000;
}
.cp__tolerance-info[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 6px;
  transform: none;
  border: 5px solid transparent;
  border-top-color: rgba(15, 15, 20, 0.95);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 10000;
}
.cp__tolerance-info[data-tooltip]:hover::after,
.cp__tolerance-info[data-tooltip]:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cp__tolerance-info[data-tooltip]:hover::before,
.cp__tolerance-info[data-tooltip]:focus::before {
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .cp__tolerance-info[data-tooltip]::after {
  background: rgba(24, 24, 27, 0.95);
}
[data-theme="light"] .cp__tolerance-info[data-tooltip]::before {
  border-top-color: rgba(24, 24, 27, 0.95);
}

.cp__tolerance-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text, #e4e4e7);
  min-width: 2ch;
  text-align: end;
  margin-inline-start: auto;
}

.cp__tolerance-slider {
  width: 100%;
  accent-color: var(--cp-active-color, var(--color-primary, #8b5cf6));
  cursor: pointer;
  margin-bottom: 6px;
}

.cp__tolerance-preview {
  height: 6px;
  border-radius: 3px;
  opacity: 0.55;
  transition: background 200ms;
}

/* ── Photographer filter ─────────────────────────────────────────────────── */
.photographer-filter {
  position: relative;
}

.photographer-filter__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.photographer-filter__input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 8px;
  background: var(--surface-1, rgba(255,255,255,.06));
  color: var(--text-primary, #fff);
  font-size: .875rem;
  outline: none;
  transition: border-color .2s;
}

.photographer-filter__input::placeholder {
  color: var(--text-tertiary, rgba(255,255,255,.35));
}

.photographer-filter__input:focus {
  border-color: var(--accent, #8b5cf6);
}

[data-theme="light"] .photographer-filter__input {
  background: #fff;
  border-color: var(--border, rgba(0,0,0,.15));
  color: var(--text-primary, #1a1a2e);
}
[data-theme="light"] .photographer-filter__input::placeholder {
  color: rgba(0,0,0,.4);
}

.photographer-filter__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255,255,255,.5));
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
}

.photographer-filter__clear:hover {
  color: var(--text-primary, #fff);
  background: rgba(255,255,255,.08);
}

[data-theme="light"] .photographer-filter__clear:hover {
  color: var(--text-primary, #1a1a2e);
  background: rgba(0,0,0,.06);
}

.photographer-filter__suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface-2, #1e1e2e);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  max-height: 240px;
  overflow-y: auto;
}

[data-theme="light"] .photographer-filter__suggestions {
  background: #fff;
  border-color: rgba(0,0,0,.1);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.photographer-filter__suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s;
}

.photographer-filter__suggestion:hover {
  background: rgba(139,92,246,.12);
}

.photographer-filter__suggestion-name {
  font-size: .875rem;
  color: var(--text-primary, #fff);
}

[data-theme="light"] .photographer-filter__suggestion-name {
  color: var(--text-primary, #1a1a2e);
}

.photographer-filter__suggestion-count {
  font-size: .75rem;
  color: var(--text-tertiary, rgba(255,255,255,.35));
  white-space: nowrap;
  margin-inline-start: 8px;
}

[data-theme="light"] .photographer-filter__suggestion-count {
  color: var(--text-tertiary, rgba(0,0,0,.4));
}

.photographer-link {
  color: var(--accent, #8b5cf6);
  text-decoration: none;
  transition: color .15s, background .15s;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 6px;
}
.photographer-link:hover {
  color: #fff;
  background: var(--accent, #8b5cf6);
}
[data-theme="light"] .photographer-link:hover {
  color: #fff;
  background: var(--accent, #8b5cf6);
}

/* ── Score threshold slider ──────────────────────────────────────────────── */
.score-threshold-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.score-threshold__header {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 4px;
}

.score-threshold__label {
  font-size: 0.78rem;
  color: var(--color-text-muted, #71717a);
}

.score-threshold__value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sth-color, #888);
  min-width: 3ch;
  text-align: end;
  margin-inline-start: auto;
  transition: color 200ms;
}

.score-threshold__slider {
  width: 100%;
  accent-color: var(--sth-color, #888);
  cursor: pointer;
  margin-bottom: 6px;
  transition: accent-color 200ms;
}

/* score-threshold__preview removed */

/* ── Source filter toggle switches (sf) ─────────────────────────────────── */
.sf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sf-item {
  /* nothing special */
}

.sf-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  padding: 2px 4px;
  transition: background 150ms;
}

.sf-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sf-toggle__icon {
  color: var(--color-text, #e4e4e7);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: auto;
  min-width: 20px;
  max-width: 80px;
}
/* Allow wordmark logos to render at natural width; normalize colours */
.sf-toggle__icon svg {
  height: 20px;
  width: auto;
  max-width: 100px;
}
/* Per-source calibration — wordmarks (pexels, pixabay) share 16px height */
.sf-toggle[data-source="pixabay"] .sf-toggle__icon svg,
.sf-toggle[data-source="pexels"] .sf-toggle__icon svg { height: 16px; }
.sf-toggle[data-source="unsplash"] { gap: 6px; }
.sf-toggle__icon svg *[fill]:not([fill="none"]) {
  fill: currentColor;
}
.sf-toggle__icon svg *[stroke]:not([stroke="none"]) {
  stroke: currentColor;
}

.sf-toggle__name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--color-text, #e4e4e7);
  font-weight: 500;
}

.sf-toggle.is-on .sf-toggle__name {
  color: var(--color-text, #e4e4e7);
}

.sf-toggle__count {
  font-size: 0.7rem;
  color: var(--color-text-muted, #71717a);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 7px;
  border-radius: 99px;
}

/* Toggle track & thumb */
.sf-toggle__track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
  margin-inline-start: auto;
  transition: background 200ms;
}
[data-theme="light"] .sf-toggle__track {
  background: rgba(0, 0, 0, 0.15);
}

.sf-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 200ms ease;
}

.sf-toggle.is-on .sf-toggle__track {
  background: var(--color-primary, #8b5cf6);
}

.sf-toggle.is-on .sf-toggle__thumb {
  transform: translateX(16px);
}

/* Focus ring on the track when checkbox is focused */
.sf-toggle__checkbox:focus-visible ~ .sf-toggle__track {
  outline: 2px solid var(--color-primary, #8b5cf6);
  outline-offset: 2px;
}

/* ── Modal search bar (inside filters panel) ─────────────────── */
.filters-panel__search {
  margin-bottom: var(--sp-4, 1rem);
}

.filters-panel__search .search-bar__form {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0;
  height: 44px;
}

.filters-panel__search .search-bar__form:focus-within {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.filters-panel__search .search-bar__icon {
  color: var(--color-text-muted, #71717a);
  padding-inline-start: 12px;
  flex-shrink: 0;
}

.filters-panel__search .search-bar__input {
  flex: 1;
  background: none;
  border: none;
  color: var(--color-text, #e4e4e7);
  font-size: 0.9rem;
  padding: 0.4rem 12px;
  outline: none;
  min-width: 0;
  line-height: 1.5;
}

.filters-panel__search .search-bar__input::placeholder {
  color: var(--color-text-muted, #71717a);
}

.filters-panel__search .search-bar__image-action {
  color: var(--color-text-muted, #71717a);
  border-inline-start-color: rgba(139, 92, 246, 0.15);
}

.filters-panel__search .search-bar__image-action:hover {
  color: var(--color-primary, #8b5cf6);
}

.filters-panel__search .search-bar__drop-panel {
  z-index: 210;
}

[data-theme="light"] .filters-panel__search .search-bar__form {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(139, 92, 246, 0.15);
}

[data-theme="light"] .filters-panel__search .search-bar__input {
  color: #18181b;
}

/* ── Search Focus slider (text_alpha) ───────────────────────────────────── */
.search-focus-section[hidden] {
  display: none !important;
}

/* Place the ? info button inline next to the heading */
.search-focus-section .filters-section__heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-focus {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-focus__header {
  display: none;
}

.search-focus__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: help;
  color: var(--color-text-muted, #71717a);
  opacity: 0.6;
  transition: opacity 180ms;
  position: relative;
}
.search-focus__info:hover { opacity: 1; }

.search-focus__info[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: max-content;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  color: #fff;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
  z-index: 10000;
}
.search-focus__info[data-tooltip]::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(15, 15, 20, 0.95);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 10000;
}
.search-focus__info[data-tooltip]:hover::after,
.search-focus__info[data-tooltip]:focus::after {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.search-focus__info[data-tooltip]:hover::before,
.search-focus__info[data-tooltip]:focus::before {
  opacity: 1; visibility: visible;
}
[data-theme="light"] .search-focus__info[data-tooltip]::after {
  background: rgba(24, 24, 27, 0.95);
}
[data-theme="light"] .search-focus__info[data-tooltip]::before {
  border-bottom-color: rgba(24, 24, 27, 0.95);
}

.search-focus__track-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 2px;
}

.search-focus__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 300ms ease, opacity 300ms ease, filter 300ms ease;
  color: var(--color-text-muted, #71717a);
}
.search-focus__icon--image.is-active {
  color: #06b6d4;
  transform: scale(1.25);
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}
.search-focus__icon--image.is-faded {
  transform: scale(0.85);
  opacity: 0.4;
}
.search-focus__icon--text.is-active {
  color: #f59e0b;
  transform: scale(1.25);
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}
.search-focus__icon--text.is-faded {
  transform: scale(0.85);
  opacity: 0.4;
}

.search-focus__slider-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-focus__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, #06b6d4, #6366f1 50%, #f59e0b);
}
.search-focus__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-primary, #8b5cf6);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
.search-focus__slider::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.5);
  transform: scale(1.1);
}
.search-focus__slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-primary, #8b5cf6);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.search-focus__slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #06b6d4, #6366f1 50%, #f59e0b);
}

.search-focus__notch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  pointer-events: none;
}

.search-focus__label {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted, #71717a);
  transition: color 200ms;
  min-height: 1.2em;
}

/* ── Precision gauge (only visible when color selected) ──────── */
.cp__tolerance-wrap {
  transition: opacity 250ms ease, max-height 250ms ease;
}

.cp__tolerance-wrap.is-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  pointer-events: none;
}

/* ── Relevance tooltip ──────────────────────────────────────── */
.score-threshold__header {
  position: relative;
}

.score-threshold__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: help;
  color: var(--color-text-muted, #71717a);
  opacity: 0.6;
  transition: opacity 180ms;
  position: relative;
  margin-inline-start: 2px;
}

.score-threshold__info:hover {
  opacity: 1;
}

.score-threshold__info[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: translateY(4px);
  width: max-content;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  color: #fff;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
  z-index: 10000;
}

.score-threshold__info[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 6px;
  transform: none;
  border: 5px solid transparent;
  border-top-color: rgba(15, 15, 20, 0.95);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 10000;
}

.score-threshold__info[data-tooltip]:hover::after,
.score-threshold__info[data-tooltip]:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.score-threshold__info[data-tooltip]:hover::before,
.score-threshold__info[data-tooltip]:focus::before {
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .score-threshold__info[data-tooltip]::after {
  background: rgba(24, 24, 27, 0.95);
}

[data-theme="light"] .score-threshold__info[data-tooltip]::before {
  border-top-color: rgba(24, 24, 27, 0.95);
}

/* ── Date filter ─────────────────────────────────────────────── */
.filters-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters-date__label {
  font-size: 0.8rem;
  color: var(--color-text-muted, #71717a);
}

/* ── Custom date picker ─────────────────────────────────────── */
.datepicker-wrap {
  position: relative;
}

.datepicker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 8px);
  color: var(--color-text, #e4e4e7);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.datepicker-trigger:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

.datepicker-trigger[aria-expanded="true"] {
  border-color: var(--color-primary, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  background: rgba(255,255,255,0.06);
}

.datepicker-trigger__icon {
  flex-shrink: 0;
  opacity: 0.5;
}

.datepicker-trigger__text {
  flex: 1;
  text-align: start;
}

.datepicker-trigger__clear {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 150ms ease;
  padding: 0 2px;
}

.datepicker-trigger__clear:hover {
  opacity: 0.9;
}

.datepicker-popup {
  position: fixed;
  width: 300px;
  padding: 12px;
  background: var(--color-surface, #1c1c1e);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10001;
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.datepicker-popup:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Manual date input */
.datepicker-manual {
  margin-bottom: 10px;
}

.datepicker-manual__input {
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md, 8px);
  color: var(--color-text, #e4e4e7);
  font-family: inherit;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.datepicker-manual__input:focus {
  outline: none;
  border-color: var(--color-primary, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.datepicker-manual__input::placeholder {
  color: var(--color-text-muted, #52525b);
}

/* Month/Year selectors */
.datepicker-selectors {
  display: flex;
  gap: 4px;
  align-items: center;
}

.datepicker-select {
  padding: 4px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm, 6px);
  color: var(--color-text, #e4e4e7);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.datepicker-select:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}

.datepicker-select:focus {
  outline: none;
  border-color: var(--color-primary, #8b5cf6);
}

.datepicker-select--month {
  min-width: 90px;
}

.datepicker-select--year {
  min-width: 60px;
}
  pointer-events: auto;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.datepicker-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text, #e4e4e7);
}

.datepicker-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  color: var(--color-text-muted, #71717a);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.datepicker-nav:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e4e4e7);
  border-color: rgba(255,255,255,0.08);
}

.datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 4px;
}

.datepicker-weekday {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted, #52525b);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.datepicker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.datepicker-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--color-text, #e4e4e7);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.datepicker-day:hover:not(.datepicker-day--disabled):not(.datepicker-day--empty) {
  background: rgba(255,255,255,0.08);
}

.datepicker-day--today {
  border: 1px solid rgba(139, 92, 246, 0.4);
  font-weight: 700;
}

.datepicker-day--selected {
  background: var(--color-primary, #8b5cf6) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.datepicker-day--disabled {
  color: rgba(255,255,255,0.15);
  cursor: default;
}

.datepicker-day--empty {
  cursor: default;
}

.datepicker-day--other-month {
  color: rgba(255,255,255,0.2);
}

.datepicker-footer {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.datepicker-today-btn,
.datepicker-clear-btn {
  flex: 1;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md, 8px);
  color: var(--color-text-muted, #a1a1aa);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.datepicker-today-btn:hover,
.datepicker-clear-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--color-text, #e4e4e7);
  border-color: rgba(255,255,255,0.12);
}

/* Light theme overrides */
[data-theme="light"] .datepicker-trigger {
  background-color: #fff;
  border-color: #d4d4d8;
  color: #18181b;
}

[data-theme="light"] .datepicker-trigger:hover {
  background-color: #f4f4f5;
  border-color: #a1a1aa;
}

[data-theme="light"] .datepicker-popup {
  background: #fff;
  border-color: #e4e4e7;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .datepicker-manual__input {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #18181b;
}

[data-theme="light"] .datepicker-select {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #18181b;
}

[data-theme="light"] .datepicker-select:hover {
  background: #e4e4e7;
}

[data-theme="light"] .datepicker-day {
  color: #18181b;
}

[data-theme="light"] .datepicker-day:hover:not(.datepicker-day--disabled):not(.datepicker-day--empty) {
  background: #f4f4f5;
}

[data-theme="light"] .datepicker-day--disabled {
  color: #d4d4d8;
}

[data-theme="light"] .datepicker-day--other-month {
  color: #c4c4c8;
}

[data-theme="light"] .datepicker-footer {
  border-top-color: #e4e4e7;
}

[data-theme="light"] .datepicker-today-btn,
[data-theme="light"] .datepicker-clear-btn {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #52525b;
}

[data-theme="light"] .datepicker-today-btn:hover,
[data-theme="light"] .datepicker-clear-btn:hover {
  background: #e4e4e7;
  color: #18181b;
}

[data-theme="light"] .datepicker-nav:hover {
  background: #f4f4f5;
  color: #18181b;
}

/* ── Sort buttons (filter modal) ─────────────────────────────── */
.filters-sort {
  display: flex;
  gap: 8px;
}

.sort-btn {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  color: var(--color-text-muted, #71717a);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.sort-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e4e4e7);
}

.sort-btn--active {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.4);
  color: var(--color-primary, #8b5cf6);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1);
}

/* ── Sort by dropdown (results bar) ─────────────────────────── */
.sort-by-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.sort-by-dropdown__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted, #71717a);
  white-space: nowrap;
}

.sort-by-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 8px);
  color: var(--color-text, #e4e4e7);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
  user-select: none;
}

.sort-by-dropdown__toggle:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.sort-by-dropdown__toggle[aria-expanded="true"] {
  border-color: var(--color-primary, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
  background: rgba(255,255,255,0.06);
}

.sort-by-dropdown__chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 200ms ease, opacity 200ms ease;
}

.sort-by-dropdown__toggle[aria-expanded="true"] .sort-by-dropdown__chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}

.sort-by-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: 4px;
  margin: 0;
  list-style: none;
  background: var(--color-surface, #1c1c1e);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
  z-index: 100;
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.sort-by-dropdown__menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sort-by-dropdown__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  color: var(--color-text-muted, #a1a1aa);
  font-size: 0.825rem;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}

.sort-by-dropdown__option:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e4e4e7);
}

.sort-by-dropdown__option--active {
  color: var(--color-primary, #8b5cf6);
  background: rgba(139,92,246,0.08);
}

.sort-by-dropdown__option--active:hover {
  background: rgba(139,92,246,0.12);
}

.sort-by-dropdown__option-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.sort-by-dropdown__option--active .sort-by-dropdown__option-icon {
  opacity: 1;
  stroke: var(--color-primary, #8b5cf6);
}

.sort-by-dropdown__check {
  margin-inline-start: auto;
  opacity: 0;
  stroke: var(--color-primary, #8b5cf6);
  transition: opacity 120ms ease;
}

.sort-by-dropdown__option--active .sort-by-dropdown__check {
  opacity: 1;
}

/* Light theme overrides */
[data-theme="light"] .sort-by-dropdown__toggle {
  background-color: #fff;
  border-color: #d4d4d8;
  color: #18181b;
}

[data-theme="light"] .sort-by-dropdown__toggle:hover {
  background-color: #f4f4f5;
  border-color: #a1a1aa;
}

[data-theme="light"] .sort-by-dropdown__menu {
  background: #fff;
  border-color: #e4e4e7;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .sort-by-dropdown__option {
  color: #52525b;
}

[data-theme="light"] .sort-by-dropdown__option:hover {
  background: #f4f4f5;
  color: #18181b;
}

[data-theme="light"] .sort-by-dropdown__option--active {
  color: var(--color-primary, #7c3aed);
  background: rgba(139,92,246,0.06);
}

[data-theme="light"] .filters-date__label {
  color: #52525b;
}

/* ── AI Search button in modal ───────────────────────────────── */
.filters-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.filters-apply__icon {
  flex-shrink: 0;
}

/* ── Signup banner ─────────────────────────────────────────────── */
.signup-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(99, 102, 241, 0.08));
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  padding: 0.75rem 0;
}

.signup-banner__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.signup-banner__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary, #8b5cf6);
}

.signup-banner__text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--color-text-muted, #a1a1aa);
  line-height: 1.5;
  margin: 0;
}

.signup-banner__text strong {
  color: var(--color-text, #e4e4e7);
  font-weight: 600;
}

.signup-banner__link {
  color: var(--color-primary, #8b5cf6);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.signup-banner__link:hover {
  color: #a78bfa;
  text-decoration: underline;
}

.signup-banner__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-muted, #71717a);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.signup-banner__close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text, #e4e4e7);
}

/* ── Rate-limit blocking modal ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  display: flex;
}

.modal-card {
  background: var(--color-surface, #18181b);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  border-radius: 16px;
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.modal-overlay.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.modal-icon--warning {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.modal-icon svg {
  width: 28px;
  height: 28px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text, #e4e4e7);
  margin-bottom: 0.5rem;
}

.modal-message {
  font-size: 0.9375rem;
  color: var(--color-text-muted, #a1a1aa);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-message strong {
  color: var(--color-text, #e4e4e7);
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.modal-actions .btn {
  min-width: 200px;
}

/* RPM variant: two side-by-side buttons */
.modal-actions--rpm {
  flex-wrap: wrap;
}
.modal-actions--rpm .btn {
  min-width: 0;
  flex: 1 1 130px;
}

/* Quota (monthly exceeded) variant: two centered side-by-side buttons */
.modal-actions--quota {
  flex-wrap: wrap;
  justify-content: center;
}
.modal-actions--quota .btn {
  min-width: 0;
  flex: 1 1 130px;
}

/* Inline upsell hint inside modal message */
.modal-upsell-inline {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #a1a1aa);
}
.modal-upsell-inline a {
  color: var(--color-primary, #8b5cf6);
  text-decoration: none;
  font-weight: 500;
}
.modal-upsell-inline a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .signup-banner__inner {
    flex-wrap: wrap;
  }
  .signup-banner__icon {
    display: none;
  }
  .modal-card {
    padding: 1.5rem 1.25rem;
  }
}

/* ============================================================
   Photo Detail Modal
   ============================================================ */
/* ============================================================
   Photo Detail Modal
   ============================================================ */
.photo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 2rem 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
}
.photo-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  display: flex;
}

.photo-modal {
  background: var(--color-bg, #0a0a0f);
  border-radius: 1rem;
  width: 100%;
  max-width: 1120px;
  position: relative;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 250ms ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.photo-modal-overlay.is-open .photo-modal {
  transform: translateY(0) scale(1);
}

/* ── Toolbar (centered action bar above image) ──── */
.photo-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--color-surface, #12121a);
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
  position: relative;
  z-index: 5;
}
.photo-modal__toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.photo-modal__toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border, rgba(255,255,255,0.12));
  border-radius: 8px;
  background: transparent;
  color: var(--color-text, #e5e5f0);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  text-decoration: none;
  padding: 0;
}
.photo-modal__toolbar-btn:hover {
  background: var(--color-surface-hover, rgba(255,255,255,0.06));
  border-color: var(--color-text-muted, #a0a0b8);
}
.photo-modal__toolbar-btn.is-liked,
.photo-modal__toolbar-actions .photo-like-btn.is-liked {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}
.photo-modal__toolbar-btn.is-liked .heart-icon,
.photo-modal__toolbar-actions .photo-like-btn.is-liked .heart-icon {
  fill: #ef4444;
  stroke: #ef4444;
}

.photo-modal__toolbar-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary, #8b5cf6);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms;
  white-space: nowrap;
}
.photo-modal__toolbar-download:hover {
  background: var(--color-primary-hover, #7c3aed);
}

/* ── Modal download dropdown ──── */
.photo-modal__download-dropdown {
  position: relative;
  display: inline-flex;
}
.photo-modal__download-dropdown .download-trigger__chevron {
  transition: transform 0.18s ease;
  flex-shrink: 0;
  margin-inline-start: 0.125rem;
}
.photo-modal__download-trigger[aria-expanded="true"] .download-trigger__chevron {
  transform: rotate(180deg);
}
.photo-modal__download-dropdown .download-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 14rem;
  background: var(--color-surface, #12121a);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 0.625rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  list-style: none;
  margin: 0;
  padding: 0.375rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 200;
}
.photo-modal__download-dropdown .download-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.photo-modal__download-dropdown .download-menu li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--color-text, #e4e4e7);
  text-decoration: none;
  gap: 0.75rem;
  cursor: pointer;
  transition: background 0.12s;
}
.photo-modal__download-dropdown .download-menu li a:hover {
  background: rgba(255, 255, 255, 0.06);
}
.photo-modal__download-dropdown .download-menu__size {
  color: var(--color-text-muted, #71717a);
  font-size: 0.75rem;
  white-space: nowrap;
}
.photo-modal__download-dropdown .download-menu__divider {
  border: none;
  padding: 0 !important;
  border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.06)) !important;
  margin: 0.25rem 0;
  cursor: default !important;
}

/* ── Modal toolbar buttons with text (Share, Like, Save) ──── */
.photo-modal__toolbar-btn {
  font-size: 0.82rem;
  font-weight: 500;
}

.photo-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border, rgba(255,255,255,0.12));
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted, #a0a0b8);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  z-index: 6;
}
.photo-modal__close:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.photo-modal__photographer {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text, #e5e5f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-modal__source {
  font-size: 0.7rem;
  text-transform: capitalize;
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-primary, #8b5cf6);
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.photo-modal__source:empty {
  display: none;
}

/* ── Image area ──── */
.photo-modal__image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface, #12121a);
  padding: 1rem;
  min-height: 300px;
  position: relative;
}
.photo-modal__image {
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  margin: 0 auto;
  transition: opacity 200ms ease;
}
.photo-modal__image.is-loading {
  opacity: 0;
  min-height: 200px;
}
.photo-modal__image-wrap:has(.is-loading)::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--color-primary, #8b5cf6);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Body ──── */
.photo-modal__desc-card {
  padding: 0 1.5rem 1.25rem;
}
.photo-modal__desc-card:empty {
  display: none;
}
.photo-modal__desc-card .meta-card {
  background: var(--color-surface, #12121a);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  border-radius: 0.875rem;
  padding: 1.25rem 1.5rem;
}
.photo-modal__desc-card .meta-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.photo-modal__desc-card .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
}
.photo-modal__desc-card .meta-row:last-child {
  border-bottom: none;
}
.photo-modal__desc-card .meta-row--full {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.photo-modal__desc-card .meta-row dt {
  font-size: 0.8125rem;
  color: var(--color-text-muted, #71717a);
  flex-shrink: 0;
}
.photo-modal__desc-card .meta-row dd {
  font-size: 0.875rem;
  color: var(--color-text, #e4e4e7);
  text-align: start;
  line-height: 1.5;
  margin: 0;
}

.photo-modal__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

/* ── Content row: image left, info right ──── */
.photo-modal__content-row {
  display: flex;
  flex-direction: row;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  align-items: flex-start;
}
.photo-modal__content-row .photo-modal__image-wrap {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  order: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}
.photo-modal__content-row .photo-modal__image-wrap img {
  max-height: 75vh;
  height: auto;
  /* Fill the image column (with the inline aspect-ratio reserving height) so the
     box is identical whether the 480w preview or the 960w is loaded — no reshape
     when the higher-res swaps in. Portrait overrides this to height-constrained. */
  width: 100%;
  max-width: 100%;
  object-fit: contain;
}
/* While the metadata is still loading, keep the (empty) meta column's width so
   the image column doesn't start full-width and then shrink when content lands. */
.photo-modal__content-row .photo-modal__meta-grid:empty {
  display: grid;
}
.photo-modal__content-row .photo-modal__meta-grid {
  /* flex-grow:0 — the meta column must NOT expand into the empty space before
     the metadata loads, otherwise it shrinks (and the image grows) when content
     lands, reshaping the layout on click. Fixed-width column = stable image box. */
  flex: 0 0 340px;
  min-width: 340px;
  max-width: 340px;
  order: 1;
}
.photo-modal-overlay[data-orientation="landscape"] .photo-modal__content-row .photo-modal__meta-grid,
.photo-modal-overlay[data-orientation="square"] .photo-modal__content-row .photo-modal__meta-grid {
  flex: 0 0 420px;
  min-width: 420px;
  max-width: 420px;
}
.photo-modal__content-row .meta-card__title {
  text-align: center;
}

@media (max-width: 700px) {
  .photo-modal__content-row {
    flex-direction: column;
    padding: 0.75rem;
    align-items: stretch;
  }
  .photo-modal__content-row .photo-modal__meta-grid {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    order: 1;
  }
  /* Override high-specificity landscape/square min-width at narrow breakpoint */
  .photo-modal-overlay[data-orientation="landscape"] .photo-modal__content-row .photo-modal__meta-grid,
  .photo-modal-overlay[data-orientation="square"] .photo-modal__content-row .photo-modal__meta-grid {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  .photo-modal__content-row .photo-modal__image-wrap {
    order: 0;
    width: 100%;
  }
}

.photo-modal__header {
  display: none;
}

.photo-modal__meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem 1.5rem;
  font-size: 0.82rem;
  color: var(--color-text-muted, #a0a0b8);
  margin-bottom: 1.25rem;
}
.photo-modal__meta dt {
  font-weight: 500;
  color: var(--color-text, #e5e5f0);
  display: inline;
}
.photo-modal__meta dt::after { content: ": "; }
.photo-modal__meta dd {
  display: inline;
  margin: 0;
}
.photo-modal__meta .meta-item {
  white-space: nowrap;
}

.photo-modal__description {
  font-size: 0.85rem;
  color: var(--color-text-muted, #a0a0b8);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.photo-modal__description:empty {
  display: none;
}

/* ── Attribution widget ─────────────────────────────────────────────────── */
.attr-widget {
  margin-bottom: 1.75rem;
}
.attr-widget__heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.6rem;
}
.attr-widget__card {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--color-surface);
}
.attr-widget__tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}
.attr-widget__tab {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.attr-widget__tab:hover {
  color: var(--color-text);
}
.attr-widget__tab.is-active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.attr-widget__pane--rich {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.6;
}
.attr-widget__pane--rich .attribution a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attr-widget__pane--code {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  border: none;
  resize: vertical;
  min-height: 5.5rem;
  box-sizing: border-box;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.attr-widget__pane--code:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
.attr-widget__copy {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 1rem 0.75rem auto;
  margin-inline-end: 1rem;
  float: right;
}
.attr-widget::after { content: ''; display: table; clear: both; }

/* ── Similar photos section inside modal ──── */
.photo-modal__similar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text, #e5e5f0);
  margin-bottom: 0.75rem;
}
.photo-modal__similar-grid {
  display: flex;
  gap: 0.5rem;
}
.photo-modal__similar-grid .masonry-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.photo-modal__similar-grid .photo-card {
  width: 100%;
  border-radius: 0.5rem;
  cursor: pointer;
}
.photo-modal__similar-grid .photo-card__img {
  border-radius: 0.5rem;
}
.photo-modal__similar-spinner {
  text-align: center;
  padding: 1rem 0;
}
.photo-modal__similar-spinner .spinner {
  width: 24px;
  height: 24px;
}

/* Save dropdown positioning inside toolbar */
.photo-modal__toolbar-actions .save-dropdown {
  right: 0;
  left: auto;
  top: 100%;
}

@media (max-width: 640px) {
  .photo-modal__similar-grid {
    flex-direction: row;
  }
  .photo-modal__similar-grid .masonry-column {
    flex: 1;
  }
  .photo-modal {
    max-width: 100%;
    border-radius: 0.75rem;
  }
  .photo-modal-overlay {
    padding: 1rem 0.5rem;
  }
  .photo-modal__toolbar {
    padding: 0.5rem 0.75rem;
    padding-inline-end: 3rem;
  }
  .photo-modal__toolbar-download span {
    display: none;
  }
}

/* ── Share dropdown inside modal toolbar ──── */
.photo-modal__share-dropdown {
  position: relative;
  display: inline-flex;
}
.share-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 12rem;
  background: var(--color-surface, #12121a);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 0.625rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  list-style: none;
  margin: 0;
  padding: 0.375rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 200;
}
.share-menu.is-open {
  opacity: 1;
  /* visibility: the critical-CSS FOUC guard in base.html pre-hides .share-menu
     with visibility:hidden (out-of-flow, no CLS). Restoring opacity alone left
     the menu invisible forever — it MUST be un-hidden here too. */
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.share-menu li a,
.share-menu li button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--color-text, #e4e4e7);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
  width: 100%;
  border: none;
  background: none;
  text-align: start;
  font-family: inherit;
}
.share-menu li a:hover,
.share-menu li button:hover {
  background: rgba(255, 255, 255, 0.06);
}
.share-menu li svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.share-menu__divider {
  border: none;
  padding: 0 !important;
  border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.06)) !important;
  margin: 0.25rem 0;
  cursor: default !important;
}

/* ── Meta cards inside modal (mirrors photo_detail.css) ──── */
.photo-modal__meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.photo-modal__meta-grid .meta-card {
  background: var(--color-surface, #12121a);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  border-radius: 0.875rem;
  padding: 1.25rem 1.5rem;
}
.photo-modal__meta-grid .meta-card__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-muted, #71717a);
  margin: 0 0 1rem 0;
}
.photo-modal__meta-grid .meta-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.photo-modal__meta-grid .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
}
.photo-modal__meta-grid .meta-row:last-child {
  border-bottom: none;
}
.photo-modal__meta-grid .meta-row--full {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.photo-modal__meta-grid .meta-row dt {
  font-size: 0.8125rem;
  color: var(--color-text-muted, #71717a);
  white-space: nowrap;
  flex-shrink: 0;
}
.photo-modal__meta-grid .meta-row dd {
  font-size: 0.875rem;
  color: var(--color-text, #e4e4e7);
  text-align: end;
  line-height: 1.5;
  margin: 0;
}
.photo-modal__meta-grid .meta-row--full dd {
  text-align: start;
}
.photo-modal__meta-grid .meta-color {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
.photo-modal__meta-grid .meta-color__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.photo-modal__meta-grid .meta-color__link--hex {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  opacity: 0.75;
}
.photo-modal__meta-grid .meta-color__dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}
.photo-modal__meta-grid .badge--source {
  display: inline-block;
  padding: 0.15em 0.55em;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.35em;
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-primary, #8b5cf6);
}
.photo-modal__meta-grid:empty {
  display: none;
}

/* ── Photographer profiles (pills row inside meta-row dd) ────────────────── */
.meta-photographer-profiles__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.meta-photographer-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  border-radius: 2rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text, #e4e4e7);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  white-space: nowrap;
}
.meta-photographer-profile-link svg {
  flex-shrink: 0;
  height: 20px;
  width: auto;
  max-width: 90px;
}
.meta-photographer-profile-link__name {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
}
/* Per-source logo size calibration */
.meta-photographer-profile-link--pixabay svg { height: 16px; }
.meta-photographer-profile-link--unsplash { gap: 0.2rem; }
/* Force API logos (e.g. Unsplash hardcoded #000) to inherit currentColor */
.meta-photographer-profile-link svg *[fill]:not([fill="none"]) {
  fill: currentColor;
}
.meta-photographer-profile-link svg *[stroke]:not([stroke="none"]) {
  stroke: currentColor;
}
.meta-photographer-profile-link:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.45);
  color: var(--color-primary, #8b5cf6);
}
.meta-photographer-profile-link--no-url {
  cursor: default;
  opacity: 0.65;
}
[data-theme="light"] .meta-photographer-profile-link {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.03);
  color: var(--color-text, #18181b);
}
[data-theme="light"] .meta-photographer-profile-link:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.35);
  color: #7c3aed;
}

/* ── Toast (shared by search & detail) ──── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--color-surface, #12121a);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  color: var(--color-text, #e4e4e7);
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ===========================================================================
   SEARCH-BAR — Base styles (extracted from home.css)
   =========================================================================== */

.search-bar {
  width: 100%;
  position: relative;
}

.search-bar__form {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 58px;
  padding: 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, rgba(245, 247, 252, 0.95), rgba(232, 236, 244, 0.93));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.search-bar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #757d8e;
  margin-inline-start: 0.6rem;
}

.search-bar__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #181b24;
  font-size: clamp(0.94rem, 2.4vw, 1.02rem);
  line-height: 1.5;
  padding: 0.55rem 0.35rem;
}

.search-bar__input::placeholder {
  color: #6f7789;
}

.search-bar__input:focus {
  outline: none;
}

.search-bar__image-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.25rem;
  color: #545d73;
  border-inline-start: 1px solid rgba(84, 93, 115, 0.25);
  padding: 0;
  margin: 0;
  background: none;
  border-top: none;
  border-inline-end: none;
  border-bottom: none;
  cursor: pointer;
  flex-shrink: 0;
}

.search-bar__image-action:hover {
  color: #1f293d;
}

.search-bar__submit {
  border: 0;
  min-width: 128px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(120deg, #5f3bff, #7f47ef 55%, #9854e7);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(86, 54, 219, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.search-bar__ai-icon {
  flex-shrink: 0;
}

.search-bar__submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

/* ── Filter button inside search bar ──── */
.search-bar__filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.25rem;
  color: #545d73;
  border-inline-start: 1px solid rgba(84, 93, 115, 0.25);
  border-top: none;
  border-inline-end: none;
  border-bottom: none;
  padding: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}
.search-bar__filter-btn:hover {
  color: #1f293d;
}

@media (max-width: 639px) {
  .search-bar__form {
    min-height: 56px;
    padding: 0.35rem;
    gap: 0;
  }

  .search-bar__icon {
    margin-inline-start: 0.45rem;
  }

  .search-bar__image-action {
    width: 2.5rem;
    height: 2rem;
  }

  .search-bar__submit {
    min-width: 50px;
    width: 50px;
    height: 44px;
    padding: 0;
  }
}

/* ── Image search: thumbnail preview ──────────────────────────────────────── */
.search-bar__thumb {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: visible;
  margin-inline-end: 0.15rem;
}

.search-bar__thumb[hidden] { display: none !important; }

.search-bar__thumb-img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1.5px solid rgba(127, 71, 239, 0.6);
  box-shadow: 0 0 0 2px rgba(127, 71, 239, 0.18);
}

.search-bar__thumb-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, transform 0.1s;
  z-index: 1;
}

.search-bar__thumb-x:hover {
  background: #dc2626;
  transform: scale(1.15);
}

/* ── Drag-over state ──────────────────────────────────────────────────────── */
.search-bar--drag-over .search-bar__form {
  border-color: #7f47ef !important;
  background: rgba(127, 71, 239, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(127, 71, 239, 0.2), 0 12px 36px rgba(0, 0, 0, 0.35);
}

/* ── Drop panel ───────────────────────────────────────────────────────────── */
.search-bar__drop-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 500;
  background: rgba(14, 14, 22, 0.97);
  border: 1px solid rgba(127, 71, 239, 0.45);
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(127, 71, 239, 0.12);
  padding: 1.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.search-bar__drop-panel[hidden] { display: none !important; }

.search-bar__drop-zone {
  border: 2px dashed rgba(127, 71, 239, 0.45);
  border-radius: 0.75rem;
  padding: 1.75rem 1rem 1.5rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

.search-bar__drop-zone.is-drag-over {
  border-color: #7f47ef;
  background: rgba(127, 71, 239, 0.1);
  border-style: solid;
}

.search-bar__drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 0.875rem;
  border-radius: 50%;
  background: rgba(127, 71, 239, 0.12);
  color: rgba(139, 92, 246, 0.9);
}

.search-bar__drop-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e4e4e7;
  margin: 0 0 0.25rem;
}

.search-bar__drop-or {
  display: block;
  font-size: 0.78rem;
  color: #71717a;
  margin: 0.5rem 0;
}

.search-bar__drop-browse {
  display: inline-block;
  padding: 0.4rem 1.35rem;
  background: linear-gradient(120deg, #5f3bff, #7f47ef 55%, #9854e7);
  color: #fff;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(86, 54, 219, 0.35);
}

.search-bar__drop-browse:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.search-bar__drop-hint {
  font-size: 0.72rem;
  color: #52525b;
  margin: 0.875rem 0 0;
  letter-spacing: 0.03em;
}

/* ── Drop panel: light mode ── */
[data-theme="light"] .search-bar__drop-panel {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(139, 92, 246, 0.1);
}
[data-theme="light"] .search-bar__drop-title {
  color: #1f293d;
}
[data-theme="light"] .search-bar__drop-or {
  color: #6b7280;
}
[data-theme="light"] .search-bar__drop-hint {
  color: #6b7280;
}
[data-theme="light"] .search-bar__drop-zone {
  border-color: rgba(139, 92, 246, 0.3);
}
[data-theme="light"] .search-bar__drop-zone.is-drag-over {
  background: rgba(139, 92, 246, 0.06);
}

/* ── Analyzing state ──────────────────────────────────────────────────────── */
.search-bar--analyzing .search-bar__input,
.search-bar--analyzing .search-bar__thumb {
  opacity: 0.55;
  pointer-events: none;
}

/* ── Error message ────────────────────────────────────────────────────────── */
.search-bar__image-error {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #ef4444;
  text-align: center;
  padding: 0 0.5rem;
}

/* ── sr-only utility ──────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Recent searches dropdown ─────────────────────────────────────────────── */
.search-bar__recent-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 500;
  background: rgba(14, 14, 22, 0.97);
  border: 1px solid rgba(127, 71, 239, 0.35);
  border-radius: 0.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(127, 71, 239, 0.12);
  padding: 0.5rem 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}
.search-bar__recent-dropdown[hidden] { display: none !important; }

.search-bar__recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--color-text, #e4e4e7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
  cursor: pointer;
}
.search-bar__recent-item:hover {
  background: rgba(127, 71, 239, 0.12);
}
.search-bar__recent-item__icon {
  flex-shrink: 0;
  color: var(--color-text-muted, #71717a);
}
.search-bar__recent-item__query {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-bar__recent-item__time {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted, #71717a);
}

.search-bar__recent-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  border-top: 1px solid rgba(127, 71, 239, 0.2);
  background: transparent;
  color: var(--color-text-muted, #71717a);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.search-bar__recent-clear:hover {
  color: var(--color-error, #ef4444);
  background: rgba(239, 68, 68, 0.08);
}

.search-bar__recent-loading {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #71717a);
  text-align: center;
}

.search-bar__recent-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #71717a);
}
.search-bar__recent-signin a {
  color: var(--color-primary, #7f47ef);
  text-decoration: none;
}
.search-bar__recent-signin a:hover {
  text-decoration: underline;
}

[data-theme="light"] .search-bar__recent-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(127, 71, 239, 0.2);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .search-bar__recent-item:hover {
  background: rgba(127, 71, 239, 0.06);
}
[data-theme="light"] .search-bar__recent-clear {
  border-top-color: rgba(127, 71, 239, 0.1);
}

/* ── Keyword tags (modal) ──────────────────────────────────────────────── */
.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.keyword-tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 0.35em;
  background: rgba(139, 92, 246, 0.12);
  color: var(--color-primary, #8b5cf6);
  border: 1px solid rgba(139, 92, 246, 0.2);
  text-transform: capitalize;
}
.keyword-tag--link {
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.keyword-tag--link:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.4);
}
.keyword-tag--hidden {
  display: none;
}
.keyword-tags__more {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.7em;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 0.35em;
  background: rgba(255,255,255,0.06);
  color: var(--color-text-muted, #a1a1aa);
  border: 1px solid rgba(255,255,255,0.10);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.keyword-tags__more:hover {
  background: rgba(255,255,255,0.10);
  color: var(--color-text, #e4e4e7);
}
[data-theme="light"] .keyword-tag {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.18);
}
[data-theme="light"] .keyword-tag--link:hover {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.3);
}
[data-theme="light"] .keyword-tags__more {
  background: #f4f4f5;
  color: #52525b;
  border-color: #d4d4d8;
}

/* ── Adaptive meta-grid width by orientation ──────────────────────────── */
.photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row {
  gap: 0.75rem;
  justify-content: center;
}
.photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row .photo-modal__image-wrap {
  flex: 0 1 auto;
  max-width: none;
  display: flex;
  justify-content: center;
}
.photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row .photo-modal__image-wrap img {
  /* Definite height (with the inline aspect-ratio giving the width) reserves the
     portrait box before the image loads — no grow from a min-height stub to 70vh. */
  height: 70vh;
  max-height: 70vh;
  width: auto;
  max-width: 100%;
}
.photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row .photo-modal__meta-grid {
  flex: 0 0 340px;
  min-width: 340px;
  max-width: 340px;
}
@media (max-width: 900px) {
  .photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row {
    flex-direction: column;
  }
  .photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row .photo-modal__meta-grid {
    flex: 1 1 auto;
    max-width: 100%;
    min-width: 0;
  }
  .photo-modal-overlay[data-orientation="portrait"] .photo-modal__content-row .photo-modal__image-wrap {
    justify-content: center;
  }
}


/* Modal main image: the .photo-modal__image-wrap receives the background */
.photo-modal__image-wrap {
  background-size: cover;
  background-position: center;
}

