:root {
  --ink: #18201f;
  --muted: #62706c;
  --paper: #faf7ef;
  --surface: #ffffff;
  --line: #ddd8cd;
  --teal: #0e766e;
  --teal-dark: #0a5650;
  --coral: #d85f45;
  --amber: #e3a323;
  --green: #587c4b;
  --plum: #704b70;
  --shadow: 0 18px 50px rgba(24, 32, 31, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

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

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
.toggle-row {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(250, 247, 239, 0.88);
  border-bottom: 1px solid rgba(98, 112, 108, 0.2);
  backdrop-filter: blur(18px);
}

.brand,
.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
}

.site-nav {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.site-nav a {
  padding: 8px 0;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
}

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(440px, 62vh, 620px);
  overflow: hidden;
  isolation: isolate;
}

.hero-media,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-media {
  z-index: -2;
  object-fit: cover;
  object-position: center;
}

.hero-overlay {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(24, 32, 31, 0.76), rgba(24, 32, 31, 0.24) 52%, rgba(24, 32, 31, 0.1)),
    linear-gradient(0deg, rgba(250, 247, 239, 0.04), rgba(250, 247, 239, 0));
}

.hero-content {
  width: min(100% - 36px, 1180px);
  margin: 0 auto;
  padding: 64px 0 56px;
  color: #fff;
}

.eyebrow {
  margin: 0 0 10px;
  color: currentColor;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.78;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(2.5rem, 6vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(760px, 100%);
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel input {
  min-width: 0;
  border: 0;
  padding: 16px 18px;
  color: var(--ink);
  background: transparent;
  outline: 0;
}

.search-panel button,
.tray-actions button,
.product-actions button,
.ghost-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
}

.search-panel button,
.tray-actions button:last-child,
.product-actions .compare-button {
  color: #fff;
  background: var(--teal);
}

.search-panel button:hover,
.tray-actions button:last-child:hover,
.product-actions .compare-button:hover {
  background: var(--teal-dark);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 850px;
  margin-top: 18px;
}

.chip {
  min-height: 38px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  font-weight: 800;
}

.chip:hover,
.chip:focus-visible,
.chip.active {
  color: var(--ink);
  background: #fff;
}

.market-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.market-strip div {
  display: grid;
  gap: 2px;
  padding: 20px clamp(18px, 4vw, 56px);
  background: #f4eadb;
}

.market-strip strong {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  line-height: 1;
}

.market-strip span {
  color: var(--muted);
  font-weight: 700;
}

.comparison-shell {
  width: min(100% - 36px, 1220px);
  margin: 0 auto;
  padding: 56px 0 128px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-heading .eyebrow {
  color: var(--teal);
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.sort-field select {
  min-height: 44px;
  padding: 0 40px 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(24, 32, 31, 0.08);
}

.filter-block {
  display: grid;
  gap: 12px;
}

.filter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 800;
}

.filter-label output {
  color: var(--teal);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink);
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  aspect-ratio: 1;
  accent-color: var(--teal);
}

.retailer-panel {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quality-meter {
  height: 10px;
  overflow: hidden;
  background: #e8dfd1;
  border-radius: 999px;
}

.quality-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--coral));
}

.retailer-panel strong {
  font-size: 1.7rem;
  line-height: 1;
}

.retailer-panel span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.results-area {
  min-width: 0;
}

.result-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 800;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  display: grid;
  grid-template-rows: 190px minmax(272px, auto);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(24, 32, 31, 0.08);
}

.product-photo {
  min-height: 0;
  background-image: var(--photo);
  background-position: var(--photo-position, center);
  background-size: 320%;
  border-bottom: 1px solid var(--line);
}

.product-body {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  gap: 10px;
  padding: 16px;
}

.card-meta,
.price-row,
.product-actions,
.store-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-badge,
.deal-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.category-badge {
  color: var(--teal-dark);
  background: #dcefeb;
}

.deal-badge {
  color: #73391f;
  background: #f6dfb1;
}

.rating {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.store-line {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

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

.price-row {
  align-items: baseline;
  justify-content: flex-start;
}

.price-row strong {
  font-size: 1.9rem;
  line-height: 1;
}

.price-row s {
  color: var(--muted);
  font-weight: 700;
}

.price-row span {
  color: var(--coral);
  font-weight: 900;
}

.history-bars {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: end;
  gap: 5px;
  height: 44px;
  padding-top: 6px;
}

.history-bars span {
  min-height: 8px;
  background: #cfd9d4;
  border-radius: 999px 999px 2px 2px;
}

.history-bars span:last-child {
  background: var(--teal);
}

.product-actions {
  margin-top: 2px;
}

.product-actions button {
  flex: 1;
}

.watch-button {
  color: var(--ink);
  background: #f2ede3;
  border: 1px solid var(--line);
}

.watch-button[aria-pressed="true"] {
  color: #fff;
  background: var(--plum);
  border-color: var(--plum);
}

.compare-button.selected {
  background: var(--ink);
}

.empty-state {
  padding: 36px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.compare-tray {
  position: fixed;
  right: clamp(14px, 4vw, 34px);
  bottom: 18px;
  left: clamp(14px, 4vw, 34px);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
  color: #fff;
  background: rgba(24, 32, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compare-tray div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#compareNames {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.76);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tray-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.ghost-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.tray-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.compare-dialog {
  width: min(880px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compare-dialog::backdrop {
  background: rgba(24, 32, 31, 0.52);
}

.dialog-frame {
  margin: 0;
  padding: 22px;
}

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.dialog-heading .eyebrow {
  color: var(--teal);
}

.icon-close {
  display: grid;
  place-items: center;
  width: 40px;
  aspect-ratio: 1;
  color: var(--ink);
  background: #f2ede3;
  border-radius: 8px;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-block,
  .retailer-panel {
    grid-column: span 1;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: 92px;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    min-height: clamp(500px, 72vh, 620px);
  }

  .hero-overlay {
    background: linear-gradient(0deg, rgba(24, 32, 31, 0.76), rgba(24, 32, 31, 0.2));
  }

  .hero-content {
    padding-bottom: 34px;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 4.2rem);
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

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

  .section-heading,
  .compare-tray {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-field {
    justify-content: space-between;
  }

  .sort-field select,
  .tray-actions button {
    width: 100%;
  }

  .filters,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-rows: 220px minmax(260px, auto);
  }

  .tray-actions {
    width: 100%;
  }
}

@media (max-width: 440px) {
  .site-header,
  .comparison-shell,
  .hero-content {
    width: calc(100% - 28px);
    padding-left: 0;
    padding-right: 0;
  }

  .site-header {
    width: auto;
    padding-left: 14px;
    padding-right: 14px;
  }

  .card-meta,
  .store-line,
  .price-row,
  .product-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .price-row {
    gap: 4px;
  }
}
