/* The marketplace a person walks through: a product, a store, the departments. Wider than the pages to read
   (page.css), on the same water; the shared look is base.css. Nothing here is smaller than 12px. */

.market {
  flex: none;
  width: calc(100% - 2 * var(--gutter));
  max-width: var(--wide);
  margin: clamp(16px, 4vw, 40px) auto clamp(40px, 7vw, 80px);
}
.market > h1,
.market > .by,
.market > .crumbs,
.market > .store-head,
.market > .ship,
.market > .pw { max-width: 820px; }
.market h1 { font-size: clamp(28px, 4.4vw, 44px); }
.market .by { margin-bottom: 18px; }

.crumbs { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--ink-2); text-decoration: none; font-weight: 520; }
.crumbs a:hover { color: var(--brand-ink); text-decoration: underline; }

/* small shared pieces: an icon, a store's sign, a link in the text */
.ico { display: block; flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.av { display: grid; place-items: center; flex: none; width: 22px; height: 22px; font-size: 12px; font-weight: 700; font-style: normal; line-height: 1; color: var(--brand-ink); background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 7px; }
.lnk { color: var(--brand-ink); text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; }

/* Price Watch's word, and what the store says about delivery */
.pw {
  margin: 0 0 6px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.pw b { color: var(--ink); margin-right: 4px; }
.pw.good { background: color-mix(in srgb, var(--good) 11%, var(--surface)); border-color: color-mix(in srgb, var(--good) 34%, transparent); }
.pw.good b { color: var(--good); }
.pw.warn { background: color-mix(in srgb, var(--amber, var(--warn)) 12%, var(--surface)); border-color: color-mix(in srgb, var(--amber, var(--warn)) 38%, transparent); }
.pw.warn b { color: var(--warn); }
.pw a,
.ship a { color: var(--brand-ink); white-space: nowrap; }
.ship { margin: 16px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.ship b { color: var(--ink); margin-right: 4px; }

/* sections under the product: its prices, the same elsewhere, more from the store */
.block {
  margin: 22px 0 0;
  padding: clamp(18px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-1);
}
.block h2 { margin: 0 0 14px; }
.block .note { margin-top: 12px; }
.chart { display: block; width: 100%; height: auto; max-height: 180px; }
.chart path { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* tiles: a product in a grid */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.market > .tiles { margin-top: 18px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 10px 10px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.tile:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.tile-pic { display: grid; place-items: center; aspect-ratio: 1; margin: 0 0 6px; overflow: hidden; background: #f3f5f8; border-radius: 12px; }
.tile-pic img { width: 100%; height: 100%; object-fit: contain; }
.tile-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 520;
}
.tile-price { font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.tile-price s { margin-left: 4px; font-size: 12px; font-weight: 450; color: var(--muted); }
/* a price in another currency than the buyer's: "about" in theirs, and the store's own price small under it */
.tile-price i { font: normal 450 12.5px/1 var(--font); letter-spacing: 0; color: var(--muted); }
.tile-own { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.tile-store { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }

/* a store's own head */
.store-head { margin: 0 0 6px; }
.store-head .pay { display: inline-flex; align-items: center; text-decoration: none; }

/* the departments */
.depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 8px; }
.dept {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 14px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}
.dept:hover { transform: translateY(-2px); border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.dept-pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 8px; }
.dept-pics img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 10px; }
.dept b { font-size: 17px; font-weight: 620; letter-spacing: -0.02em; }
.dept span:last-child { font-size: 13px; color: var(--muted); }

/* all departments: each top department with a few of its pictures, and the departments in it */
.verts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 8px; align-items: start; }
.vert { display: flex; flex-direction: column; min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-1); }
.vert > .dept { padding: 0 0 10px; background: none; border: 0; border-radius: 0; box-shadow: none; }
.vert > .dept:hover { transform: none; box-shadow: none; }
.vert > .dept:hover b { color: var(--brand-ink); }
.subs { margin: 0; padding: 0; list-style: none; }
.subs li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 2px; font-size: 14px; border-top: 1px solid var(--line); }
.subs a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.subs a:hover { color: var(--brand-ink); text-decoration: underline; }
.subs span { flex: none; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* the departments in one, and the departments a store sells in: one press each */
.subdepts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.subdepts a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 520;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.subdepts a:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.subdepts span { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.pages { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0 0; font-size: 15px; color: var(--muted); }
.pages a { color: var(--brand-ink); font-weight: 560; text-decoration: none; }

@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 8px 8px 10px; border-radius: 14px; }
  .depts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dept b { font-size: 15px; }
}
