:root {
  font-family: system-ui, sans-serif;
  color-scheme: light;
  --ink: #262923;
  --background: #f8f5ed;
  --surface: #fffefa;
  --muted: #5a6255;
  --border: #dfded2;
  --control-border: #8b9382;
  --accent: #365343;
  --accent-wash: #e8eee1;
  --active-background: #304938;
  --active-text: #fffefa;
  --masthead-start: #26372e;
  --masthead-end: #3c5140;
  --masthead-text: #fffcf1;
  --masthead-rule: #c7ac74;
  --shadow: 0 9px 23px #232d1f0c;
  color: var(--ink);
  background: var(--background);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f0e5;
  --background: #171c18;
  --surface: #232b23;
  --muted: #c0c8bb;
  --border: #384738;
  --control-border: #748676;
  --accent: #d7e6cb;
  --accent-wash: #354534;
  --active-background: #d6e2c6;
  --active-text: #202c21;
  --masthead-start: #121913;
  --masthead-end: #29392b;
  --masthead-text: #f7f1dc;
  --masthead-rule: #b59860;
  --shadow: 0 9px 23px #0003;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
.wrap { width: min(100% - 3rem, 70rem); margin-inline: auto; }
.masthead {
  background: linear-gradient(115deg, var(--masthead-start), var(--masthead-end));
  color: var(--masthead-text);
  border-bottom: 2px solid var(--masthead-rule);
}
.masthead-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}
.theme-control {
  display: flex;
  padding: .2rem;
  flex: none;
  border: 1px solid #ffffff62;
  border-radius: 2rem;
}
.theme-control button {
  color: var(--masthead-text);
  border-color: transparent;
  padding: .42rem .72rem;
  font-size: .9rem;
  line-height: 1.35;
}
.theme-control button:hover { background: #ffffff19; }
.theme-control button[aria-pressed="true"] { background: #faf4df; color: #203026; border-color: transparent; }
.theme-control button:focus-visible { outline-color: var(--masthead-rule); }
h1, h2 { font-family: Georgia, serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(2.45rem, 7vw, 4.7rem); line-height: 1.04; overflow-wrap: anywhere; }
h2 { margin: 0 0 .85rem; font-size: clamp(1.65rem, 4vw, 2.15rem); line-height: 1.1; }
main { padding-bottom: 4rem; }
.filters {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .7rem 1.5rem;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding-block: 1rem .9rem;
  margin-bottom: 1.9rem;
}
.search { display: grid; gap: .35rem; flex: 1 0 15rem; max-width: 20rem; }
.search span { color: var(--muted); font-weight: 600; font-size: .875rem; }
.search input {
  width: 100%;
  padding: .62rem .8rem;
  border: 1px solid var(--control-border);
  border-radius: .7rem;
  background: var(--surface);
  color: inherit;
}
nav {
  display: flex;
  gap: .5rem;
  max-width: 100%;
  overflow-x: auto;
  padding: .22rem;
  scrollbar-width: thin;
}
nav button { flex: none; white-space: nowrap; }
button {
  border: 1px solid var(--control-border);
  border-radius: 2rem;
  color: var(--accent);
  background: transparent;
  padding: .62rem .95rem;
  cursor: pointer;
}
button:hover { background: var(--accent-wash); }
button[aria-pressed="true"] { color: var(--active-text); background: var(--active-background); border-color: var(--active-background); }
:focus-visible { outline: .18rem solid var(--accent); outline-offset: .19rem; }
.category + .category { margin-top: 2.3rem; }
.category h2 { display: flex; align-items: center; gap: .8rem; }
.category h2::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.item-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .85rem; }
.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.item img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: var(--accent-wash); }
.item-photo { margin: 0; }
.item-photo figcaption { padding: .4rem 1.25rem 0; color: var(--muted); font-size: .875rem; }
.item-body { padding: 1.1rem 1.25rem; }
.item-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .6rem; }
h3 { margin: 0; overflow-wrap: anywhere; font-size: 1.12rem; line-height: 1.4; }
.price {
  color: var(--accent);
  background: var(--accent-wash);
  border-radius: 2rem;
  padding: .32rem .6rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.item p { color: var(--muted); margin: .5rem 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.item-details { margin-top: .65rem; border-top: 1px solid var(--border); }
.item-details summary {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
  list-style: none;
  min-height: 2.7rem;
  padding-top: .35rem;
  color: var(--accent);
  cursor: pointer;
  font-size: .95rem;
}
.item-details summary::-webkit-details-marker { display: none; }
.item-details summary::after { content: "+"; font-size: 1.18rem; }
.item-details[open] summary::after { content: "−"; }
.item-details dl { margin: .55rem 0 .15rem; }
.item-details dt { margin-top: .8rem; font-weight: 650; }
.item-details dd { margin: .22rem 0 0; color: var(--muted); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
#status { color: var(--muted); }

@media (max-width: 38rem) {
  .wrap { width: calc(100% - 2rem); }
  .masthead-content { flex-direction: column-reverse; gap: .7rem; padding-block: 1rem 1.7rem; }
  .theme-control { align-self: flex-end; }
  .filters { align-items: stretch; gap: .7rem; margin-bottom: 1.35rem; padding-block: .7rem; }
  .search { flex-basis: 100%; max-width: none; }
  .item-list { grid-template-columns: minmax(0, 1fr); }
}
