:root {
  color-scheme: light;
  --ink: #1e2622;
  --muted: #68716d;
  --paper: #f4f1e8;
  --line: #cbc8bc;
  --accent: #d84b2f;
  --content-max: 1600px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Georgia, "Times New Roman", serif; }
header, .controls, .view-options, .grid { width: 100%; max-width: var(--content-max); margin-inline: auto; }
header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding: 1.35rem clamp(1rem, 2vw, 2rem) 1.2rem; border-bottom: 1px solid var(--line); }
.heading-group { min-width: 0; }
h1 { margin: 0; font-size: clamp(2rem, 3.5vw, 3.25rem); font-weight: 400; line-height: .95; }
.eyebrow, .summary, .controls, .view-options, .meta { font-family: "Arial Narrow", "Helvetica Neue", sans-serif; letter-spacing: 0; }
.eyebrow { margin: 0 0 .3rem; color: var(--accent); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.summary { margin: 0; color: var(--muted); white-space: nowrap; }
.controls { display: grid; grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(9rem, 1fr)); gap: 1px; padding: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.controls label { display: grid; gap: .4rem; padding: .85rem clamp(1rem, 2vw, 2rem); background: var(--paper); color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
input, select { width: 100%; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font: 1rem Georgia, serif; }
.view-options { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem clamp(1rem, 2vw, 2rem); border-bottom: 1px solid var(--line); }
.density-control { display: flex; gap: 1px; margin: 0; padding: 1px; border: 0; background: var(--line); }
.density-control legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.density-control label { padding: .5rem .8rem; background: var(--paper); color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.density-control label:has(input:checked) { color: #fff; background: var(--ink); }
.density-control input { position: absolute; width: auto; opacity: 0; pointer-events: none; }
.view-toggles { display: flex; align-items: center; gap: 1rem; }
.view-toggle { display: flex; align-items: center; gap: .55rem; color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.view-toggle input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.grid { --card-min: 300px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: 6px; padding: 6px; background: var(--paper); }
body[data-density="roomy"] .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body[data-density="dense"] .grid { --card-min: 200px; }
.card { position: relative; min-width: 0; color: inherit; background: var(--paper); }
.product-link { display: block; color: inherit; text-decoration: none; }
.image-wrap { aspect-ratio: 1.18; overflow: hidden; background: #fff; }
.card img { width: 100%; height: 100%; object-fit: contain; }
.favorite-button { position: absolute; top: .55rem; right: .55rem; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; padding: 0; border: 1px solid rgb(30 38 34 / 25%); border-radius: 50%; color: var(--ink); background: rgb(244 241 232 / 92%); box-shadow: 0 .15rem .5rem rgb(30 38 34 / 18%); cursor: pointer; transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease; }
.favorite-button svg { width: 1.15rem; height: 1.15rem; fill: transparent; stroke-width: 1.8; transition: fill 140ms ease, stroke 140ms ease; }
.favorite-button[aria-pressed="true"] { color: var(--accent); background: rgb(255 250 245 / 96%); }
.favorite-button[aria-pressed="true"] svg { fill: currentColor; }
.favorite-button:hover { border-color: var(--ink); }
.favorite-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.favorite-button.is-toggling { animation: favorite-press 180ms ease-out; }
.card.is-leaving { opacity: 0; transform: scale(.98); transition: opacity 180ms ease, transform 180ms ease; }
@keyframes favorite-press { 50% { transform: scale(.86); } }
.card-copy { display: none; padding: .75rem .85rem .9rem; }
.show-details .card-copy { display: block; }
.meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--accent); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.meta button { min-width: 0; width: auto; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; overflow-wrap: anywhere; }
.meta button:last-child { text-align: right; }
.meta button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .18em; }
.meta button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.title-link { display: block; color: inherit; text-decoration: none; }
.card h2 { min-height: 3.6em; margin: .45rem 0 0; overflow-wrap: anywhere; font-size: .95rem; font-weight: 400; line-height: 1.3; }
.empty { padding: 4rem; background: var(--paper); color: var(--muted); font-size: 1.2rem; }
.go-to-top { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 20; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 1px solid var(--ink); border-radius: 50%; color: #fff; background: var(--ink); box-shadow: 0 .35rem 1rem rgb(30 38 34 / 22%); cursor: pointer; }
.go-to-top svg { width: 1.2rem; height: 1.2rem; }
.go-to-top:hover { color: var(--ink); background: var(--paper); }
.go-to-top:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.go-to-top[hidden] { display: none; }

@media (max-width: 1000px) {
  body[data-density="roomy"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  header { gap: 1rem; }
  .controls { grid-template-columns: 1fr; }
  .view-options { flex-wrap: wrap; }
  .view-toggles { flex: 1; justify-content: flex-end; }
  .density-control { display: grid; grid-template-columns: repeat(3, 1fr); }
  .density-control label { text-align: center; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-density="roomy"] .grid { grid-template-columns: 1fr; }
  body[data-density="dense"] .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card h2 { min-height: 0; font-size: .9rem; }
  body[data-density="dense"] .card-copy { padding: .5rem; }
  body[data-density="dense"] .meta { gap: .35rem; font-size: .58rem; }
  body[data-density="dense"] .card h2 { margin-top: .35rem; font-size: .78rem; line-height: 1.25; }
  body[data-density="dense"] .favorite-button { top: .35rem; right: .35rem; width: 1.9rem; height: 1.9rem; }
  body[data-density="dense"] .favorite-button svg { width: 1rem; height: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .favorite-button, .card.is-leaving { transition: none; }
  .favorite-button.is-toggling { animation: none; }
}