:root {
  --ink: #191919;
  --muted: #77736f;
  --line: #e8e5e2;
  --soft: #f7f6f4;
  --coral: #ff6247;
  --violet: #8b68e8;
  --page-gutter: clamp(18px, 3vw, 48px);
  --search-header-height: 106px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: #fff; color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .asset-card:focus-visible { outline: 3px solid rgba(139, 104, 232, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.site-header { min-height: var(--search-header-height); padding: 15px var(--page-gutter); display: grid; grid-template-columns: minmax(190px, 260px) minmax(260px, 720px) auto; gap: clamp(16px, 2vw, 32px); align-items: center; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: block; width: 240px; height: 74px; overflow: hidden; position: relative; }
.brand img { position: absolute; width: 260px; max-width: none; height: auto; left: -9px; top: -24px; }
.search-form { height: 52px; border: 1px solid #d8d4d0; border-radius: 3px; display: flex; align-items: center; background: #fff; transition: border-color .2s, box-shadow .2s; }
.search-form:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,104,232,.12); }
.search-icon { width: 18px; height: 18px; margin-left: 18px; border: 1.8px solid var(--ink); border-radius: 50%; position: relative; flex: 0 0 auto; }
.search-icon::after { content: ""; width: 7px; height: 1.8px; background: var(--ink); position: absolute; right: -5px; bottom: -2px; transform: rotate(45deg); transform-origin: left center; }
.search-form input { width: 100%; height: 100%; border: 0; outline: 0; padding: 0 12px 0 15px; font-size: 16px; background: transparent; }
.search-form input::placeholder { color: #9c9894; }
.clear-search { width: 42px; height: 42px; border: 0; background: transparent; color: #76716d; font-size: 26px; }
.filter-toggle { justify-self: end; height: 44px; padding: 0 17px; border: 1px solid var(--ink); border-radius: 3px; color: var(--ink); background: #fff; font-weight: 650; }
.filter-toggle:hover { background: var(--soft); }
.filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 7px; border-radius: 50%; color: #fff; background: var(--coral); font-size: 12px; }

main { padding: 0 var(--page-gutter) 56px; }
.search-footer { min-height: 76px; padding: 24px var(--page-gutter); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 2px solid var(--coral); background: #fff; }
.search-footer p { margin: 0; color: var(--muted); font-size: 12px; }
.search-footer a { color: var(--coral); font-size: 13px; font-weight: 750; text-decoration: none; }
.search-footer a:hover, .search-footer a:focus-visible { color: #d9422c; text-decoration: underline; }
.filter-panel { margin: 0 calc(var(--page-gutter) * -1); padding: 22px var(--page-gutter); border-bottom: 1px solid var(--line); background: rgba(247,246,244,.98); display: flex; flex-wrap: wrap; align-items: end; gap: 14px; position: sticky; top: var(--search-header-height); z-index: 18; box-shadow: 0 8px 18px rgba(35,29,25,.04); }
.filter-panel[hidden] { display: none; }
.filter-field { min-width: 168px; flex: 1 1 168px; max-width: 240px; }
.filter-field label, .sort-field label, .page-size-field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.filter-field select, .sort-field select, .page-size-field select { width: 100%; height: 43px; border: 1px solid #d8d4d0; border-radius: 3px; padding: 0 34px 0 12px; color: var(--ink); background: #fff; }
.reset-filters { height: 43px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; }

.results-heading { min-height: 106px; display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 27px 0 19px; }
.results-heading h1 { margin: 0 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 3vw, 38px); font-weight: 400; letter-spacing: -.025em; }
.results-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.result-controls { display: flex; align-items: end; gap: 12px; flex: 0 0 auto; }
.sort-field { width: 145px; }
.page-size-field { width: 150px; }

.results-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.result-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.asset-card { width: 100%; margin: 0; padding: 0; display: block; border: 0; background: #f1efed; position: relative; overflow: hidden; color: #fff; text-align: left; }
.asset-card img { display: block; width: 100%; height: auto; min-height: 140px; transition: transform .35s ease, filter .35s ease; }
.asset-card:hover img, .asset-card:focus-visible img { transform: scale(1.015); filter: brightness(.82); }
.card-label { position: absolute; inset: auto 0 0; padding: 34px 14px 13px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transform: translateY(5px); transition: opacity .22s, transform .22s; }
.asset-card:hover .card-label, .asset-card:focus-visible .card-label { opacity: 1; transform: translateY(0); }
.card-label strong { display: block; font-size: 14px; line-height: 1.35; }
.card-label span { display: block; margin-top: 3px; font-size: 11px; opacity: .82; text-transform: uppercase; letter-spacing: .05em; }
.asset-card.is-loading { aspect-ratio: 4 / 3; background: linear-gradient(100deg,#f2f0ee 20%,#faf9f8 40%,#f2f0ee 60%); background-size: 200% 100%; animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }

.empty-state { padding: 90px 20px; text-align: center; border-top: 1px solid var(--line); }
.empty-state h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 30px; font-weight: 400; }
.empty-state p { color: var(--muted); }
.empty-state button { margin-top: 12px; padding: 12px 18px; border: 1px solid var(--ink); background: #fff; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; padding-top: 34px; }
.pagination button { min-width: 100px; height: 42px; border: 1px solid var(--ink); background: #fff; }
.pagination button:disabled { color: #aaa; border-color: #ddd; cursor: default; }
.pagination span { color: var(--muted); font-size: 14px; }

.preview-dialog { width: min(1440px, 100vw); height: min(920px, 100vh); max-width: none; max-height: none; margin: auto; padding: 0; border: 0; background: #fff; box-shadow: 0 30px 90px rgba(27,20,16,.22); }
.preview-dialog::backdrop { background: rgba(25,22,20,.55); backdrop-filter: blur(3px); }
.preview-close { position: absolute; z-index: 4; right: 14px; top: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--ink); font-size: 28px; line-height: 1; }
.preview-layout { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 430px); }
.preview-stage { min-width: 0; min-height: 0; display: grid; place-items: center; padding: clamp(24px,4vw,64px); background: #f3f1ef; overflow: hidden; }
.preview-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; box-shadow: 0 4px 22px rgba(0,0,0,.08); }
.preview-details { min-width: 0; min-height: 0; padding: 64px 40px 36px; overflow-y: auto; }
.preview-type { margin: 0 0 12px; color: var(--violet); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.preview-details h2 { margin: 0 0 14px; font-family: Georgia, serif; font-size: clamp(27px,3vw,38px); line-height: 1.1; font-weight: 400; }
.preview-caption { margin: 0 0 24px; color: #5f5b58; font-size: 15px; line-height: 1.6; }
.asset-facts { margin: 0 0 22px; padding: 18px 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.asset-facts dt { color: var(--muted); }
.asset-facts dd { margin: 0; text-align: right; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.keyword-list span { padding: 6px 9px; border-radius: 2px; background: var(--soft); color: #655f5b; font-size: 12px; }
.license-button { width: 100%; height: 50px; border: 0; border-radius: 3px; color: #fff; background: #c7c3c0; font-weight: 750; cursor: not-allowed; }
.license-note { margin: 9px 0 0; color: #99938f; font-size: 12px; text-align: center; }

@media (max-width: 850px) {
  .site-header { grid-template-columns: 1fr auto; min-height: 86px; }
  .brand { width: 200px; height: 64px; }
  .brand img { width: 225px; top: -20px; }
  .search-form { grid-column: 1 / -1; grid-row: 2; }
  .site-header { padding-bottom: 14px; }
  .filter-panel { position: static; }
  .results-heading { align-items: center; }
  .preview-dialog { width: 100vw; height: 100vh; }
  .preview-layout { display: block; overflow-y: auto; }
  .preview-stage { height: 58vh; padding: 20px; }
  .preview-details { overflow: visible; padding: 32px 22px 40px; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .site-header { gap: 8px; padding-left: 14px; padding-right: 14px; }
  .brand { width: 166px; height: 58px; }
  .brand img { width: 190px; top: -17px; }
  .filter-toggle { padding: 0 12px; }
  .results-heading { display: block; }
  .result-controls { width: 100%; margin-top: 18px; }
  .sort-field, .page-size-field { width: auto; flex: 1 1 0; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .result-column { gap: 7px; }
  .card-label { display: none; }
  .search-footer { min-height: 68px; padding-top: 20px; padding-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
