:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #5b6763;
  --line: #d8dfdc;
  --paper: #f8f7f1;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --warning: #9a3412;
  --price-min: 0%;
  --price-max: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 5vw, 56px) 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.controls input {
  width: 96px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: 0;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

main {
  padding: 24px clamp(18px, 5vw, 56px) 56px;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.status-strip > div {
  min-width: 0;
  padding: 16px;
  background: var(--panel);
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(260px, 1fr) minmax(170px, 220px);
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.filter-heading {
  min-width: 0;
}

.filter-heading strong {
  display: block;
  color: var(--ink);
}

.sort-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 8px;
}

.sort-control label {
  display: grid;
  min-width: 0;
}

.sort-control select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0 34px 0 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.range-control {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.range-values {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.range-slider {
  position: relative;
  height: 34px;
}

.range-slider::before,
.range-slider::after {
  position: absolute;
  top: 15px;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 999px;
  content: "";
}

.range-slider::before {
  background: #dfe5e2;
}

.range-slider::after {
  right: calc(100% - var(--price-max));
  left: var(--price-min);
  background: var(--accent);
}

.range-slider input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.range-slider input::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid var(--accent);
  border-radius: 999px;
  appearance: none;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
  cursor: grab;
  pointer-events: auto;
}

.range-slider input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
  cursor: grab;
  pointer-events: auto;
}

.range-slider input::-webkit-slider-runnable-track,
.range-slider input::-moz-range-track {
  background: transparent;
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

a {
  color: var(--accent-dark);
  font-weight: 700;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 47 / 31.8;
  object-fit: cover;
  background: #e4e1d8;
}

.card-body {
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.25;
}

.meta {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.meta-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
}

.meta-row dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.meta-row dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.meta strong {
  color: var(--ink);
}

.summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.empty,
.error {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
}

.error {
  border-color: #fed7aa;
  color: var(--warning);
}

.details {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.details h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.details p {
  max-width: 900px;
  color: var(--muted);
  line-height: 1.55;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

li {
  margin: 10px 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .controls {
    align-items: stretch;
  }

  .controls input,
  .controls button {
    width: 100%;
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .filter-panel {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sort-control {
    grid-template-columns: minmax(0, 1fr) 44px;
  }
}

@media (max-width: 560px) {
  main {
    padding: 16px 12px 40px;
  }

  .results {
    gap: 10px;
    margin-top: 16px;
  }

  .card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .card img {
    height: 100%;
    min-height: 148px;
    aspect-ratio: auto;
  }

  .card-body {
    min-width: 0;
    padding: 12px;
  }

  .card h2 {
    margin-bottom: 9px;
    font-size: 15px;
    line-height: 1.25;
  }

  .meta {
    gap: 4px;
    margin-bottom: 0;
    font-size: 13px;
  }

  .meta-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
  }

  .meta-row-primary dd {
    color: var(--ink);
  }

  .meta-row dt {
    font-size: 10px;
  }

  .summary {
    display: none;
  }

  .details {
    margin-top: 20px;
  }
}
