/* Honzův bazar: flea-market price stickers. The sticker is the only loud element. */
:root {
  --paper: #FAFAF7;
  --ink: #1F2933;
  --muted: #5F6873;
  --line: #E3E3DE;
  --sticker-kc: #FF8A2B;
  --sticker-free: #34C26E;
  --sticker-deal: #7FA8FF;
  --sticker-sold: #C9CDD2;
  --tape: #FFD43B;
  --focus: #2563EB;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.site-header, main, .site-footer { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { padding-top: 1.75rem; }
.site-header h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.intro { max-width: 40rem; color: var(--muted); }
.intro p { margin: 0.5rem 0 0; }
.terms { max-width: 40rem; margin-top: 0.75rem; padding: 0.6rem 0.9rem; border-left: 4px solid var(--tape); background: #fff; }
.terms p { margin: 0; }
.terms p + p { margin-top: 0.35rem; }
.seller .terms { margin: 0 0 0.75rem; color: var(--ink); }

/* Category chips (JS only) */
.chips { display: flex; gap: 0.4rem; overflow-x: auto; padding: 1rem 0 0.5rem; scrollbar-width: none; }
.no-js .chips { display: none; }
.chip {
  font: inherit;
  font-size: 0.875rem;
  white-space: nowrap;
  padding: 0.2rem 0.8rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip .count { margin-left: 0.15rem; opacity: 0.7; }

/* Card grid */
.grid {
  list-style: none;
  margin: 0;
  padding: 1rem 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 0.9rem;
}
@media (min-width: 40rem) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 60rem) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card a { display: block; text-decoration: none; }
.card-photo { position: relative; }
.card-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--line);
}
.photo-count {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  padding: 0 0.4rem;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.62);
  color: #fff;
  font-size: 0.75rem;
}
.sticker {
  position: absolute;
  top: -0.7rem;
  right: -0.45rem;
  width: 4.3rem;
  height: 4.3rem;
  display: grid;
  place-items: center;
  padding: 0.35rem;
  border-radius: 50%;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.05;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.18);
}
.sticker-kc { background: var(--sticker-kc); }
.sticker-free { background: var(--sticker-free); }
.sticker-deal { background: var(--sticker-deal); }
.sticker-sold { background: var(--sticker-sold); }
.tape {
  position: absolute;
  left: -0.3rem;
  top: 42%;
  padding: 0.1rem 0.7rem;
  background: var(--tape);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  transform: rotate(-3deg);
}
.card-title { margin: 0.55rem 0 0; font-size: 1rem; line-height: 1.25; }
.card-condition { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }
.card.status-sold .card-photo img { filter: grayscale(1); opacity: 0.55; }
.card.status-sold .card-title { color: var(--muted); }

/* Index notices */
button.link {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}
.sold-toggle, .empty, .empty-site {
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  border: 1.5px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

/* Item page */
.page-item main { max-width: 60rem; padding: 0; }
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: #EDEDE8;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: start; }
.gallery-slide img { width: auto; max-height: 75vh; object-fit: contain; }
.gallery-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0.4rem 0; }
.gallery-controls button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.no-js .gallery-controls button { display: none; }
.gallery-counter { min-width: 4rem; margin: 0; color: var(--muted); font-size: 0.875rem; text-align: center; }
.item-body { max-width: 40rem; padding: 0.5rem 1rem 6rem; }
.back { color: var(--muted); font-size: 0.9rem; }
.item-body h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.price { margin: 0; font-size: 1.6rem; font-weight: 800; }
.price-new { margin: 0; color: var(--muted); font-size: 0.9rem; }
.status { display: inline-block; margin: 0.5rem 0 0; padding: 0.15rem 0.6rem; border-radius: 4px; font-weight: 700; }
.status.status-reserved { background: var(--tape); }
.status.status-sold { background: var(--sticker-sold); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.description { max-width: 65ch; }
.contact, .seller { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.contact p { margin: 0 0 0.75rem; }
.seller { color: var(--muted); font-size: 0.95rem; }
.seller p { margin: 0.25rem 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-secondary { background: var(--paper); color: var(--ink); }
.related { margin-top: 2rem; }
.related h2 { margin: 0; font-size: 1.1rem; }
.grid-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}
.sticky-price { margin-right: auto; font-weight: 800; }
.sticky-bar .btn { padding: 0.45rem 0.8rem; }
@media (min-width: 60rem) {
  .sticky-bar { display: none; }
  .item-body { padding-bottom: 2rem; }
}

/* Footer, 404 */
.site-footer { padding-bottom: 2rem; color: var(--muted); font-size: 0.85rem; }
.page-item .site-footer { max-width: 60rem; padding-bottom: 6rem; }
.notfound { padding-top: 3rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
