:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #191919;
  --muted: #68645c;
  --line: #ded9ce;
  --brand: #b92323;
  --brand-dark: #851919;
  --accent: #12685f;
  --shadow: 0 14px 36px rgba(34, 29, 21, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 10px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1;
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.title-copy {
  max-width: 440px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 640;
}

.link-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

h2 {
  font-size: 18px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.stats span {
  min-width: 92px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.stats strong {
  display: block;
  font-size: 17px;
  line-height: 1.05;
}

.controls {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(34, 29, 21, 0.08);
  backdrop-filter: blur(18px);
}

label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfc8ba;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(18, 104, 95, 0.28);
  outline-offset: 2px;
}

.search {
  min-width: 0;
}

.search > span:first-child {
  margin-bottom: 4px;
}

.search-field {
  position: relative;
  display: block;
  margin: 0;
}

.search-field::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-field::after {
  content: "";
  position: absolute;
  left: 24px;
  top: calc(50% + 7px);
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

.search input {
  min-height: 38px;
  padding: 7px 36px;
  border-color: #bbb2a1;
  background: #fff;
  font-size: 14px;
  font-weight: 720;
}

.filter-row {
  display: grid;
  gap: 9px;
  align-items: end;
}

.primary-row {
  grid-template-columns: minmax(320px, 1.8fr) repeat(4, minmax(128px, 1fr));
}

.secondary-row {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(190px, 1fr) minmax(110px, 0.7fr);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #cfc8ba;
  border-radius: 3px;
  background: #fff;
}

.checkline input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checkline span {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

button {
  min-height: 38px;
  border: 1px solid var(--brand-dark);
  border-radius: 3px;
  background: var(--brand);
  color: #fff;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

.active {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  padding: 12px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #cfc8ba;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.content {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.facets {
  position: sticky;
  top: 152px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.slice-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.slice {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #faf9f5;
  color: var(--ink);
  text-align: left;
}

.slice:hover {
  background: #f1eee6;
}

.slice small {
  color: var(--muted);
  font-weight: 700;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.results-head p {
  margin: 0;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #fff;
}

.legend strong {
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 348px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.card > button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  padding: 0;
  background: #e9e4da;
  overflow: hidden;
  cursor: pointer;
}

.thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  mix-blend-mode: multiply;
}

.image-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  height: 30px;
  border: 1px solid rgba(25, 25, 25, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.image-toggle:hover {
  background: #fff;
  color: var(--brand);
}

.card-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  padding: 9px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  padding: 2px 5px;
  background: #f1eee6;
  color: #554f46;
  font-size: 10.5px;
  font-weight: 760;
}

.card h3 {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.18;
}

.facts {
  display: grid;
  gap: 4px;
  padding: 7px 0;
  border-top: 1px solid #eee8dc;
  border-bottom: 1px solid #eee8dc;
  color: var(--muted);
  font-size: 11px;
}

.facts span {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.facts strong {
  display: inline;
  order: 2;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.links {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
}

a {
  color: var(--accent);
  font-weight: 760;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.action-link {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 28px;
  padding: 6px 8px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.action-link:hover {
  background: #0c4f48;
  text-decoration: none;
}

.action-link.secondary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.action-link.secondary:hover {
  background: var(--brand-dark);
}

.load-more {
  display: block;
  width: min(340px, 100%);
  margin: 22px auto 0;
}

dialog {
  width: min(920px, calc(100% - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(18, 16, 13, 0.62);
}

.detail {
  position: relative;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  background: #fff;
  box-shadow: var(--shadow);
}

.detail img {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: contain;
  padding: 18px;
  background: #e9e4da;
}

.detail-body {
  padding: 28px;
}

.detail-body h2 {
  font-size: 28px;
  line-height: 1.1;
}

.icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-height: 38px;
  border-color: #111;
  background: #111;
  font-size: 26px;
  line-height: 1;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 9px 16px;
  margin: 20px 0;
}

dt {
  color: var(--muted);
  font-weight: 760;
}

dd {
  margin: 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.action-link.manual {
  border-color: #3f51b5;
  background: #3f51b5;
}

.action-link.manual:hover {
  border-color: #303f9f;
  background: #303f9f;
}

.empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .controls,
  .content,
  .detail {
    grid-template-columns: 1fr;
  }

  .primary-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .primary-row .search {
    grid-column: 1 / -1;
  }

  .secondary-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(160px, 1fr) minmax(90px, 0.65fr);
  }

  .facets {
    position: static;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .topbar,
  .results-head {
    align-items: start;
    flex-direction: column;
  }

  .title-lockup {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .title-copy {
    max-width: none;
    padding-left: 0;
    border-left: 0;
  }

  .controls {
    position: static;
  }

  .filter-row,
  .primary-row,
  .secondary-row {
    grid-template-columns: 1fr 1fr;
  }

  .primary-row .search {
    grid-column: 1 / -1;
  }

  .checkline {
    grid-column: 1 / -1;
  }

  .search input {
    min-height: 48px;
    font-size: 16px;
  }

  .card {
    grid-template-rows: clamp(160px, 36vw, 210px) auto;
    min-height: 360px;
  }

  .thumb {
    height: 100%;
    aspect-ratio: auto;
  }

  .detail img {
    min-height: 260px;
  }
}
