/* ============================================================================
   SHOP (/shop/) — the spreadsheet as a shop you can scroll and filter
   Loaded only on /shop/, after /styles.css. Reuses its tokens, header, buttons
   and footer. Photos sit on light Porcelain tiles (brand guide 5.1) so the
   seller shots read cleanly on the dark page.
   ========================================================================== */

:root {
  --porcelain: #FAF8F3;
  --tile-radius: 14px;
}

/* .btn and the flex blocks below set display; keep the hidden attribute working */
[hidden] { display: none !important; }

.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;
}

/* Header: keep the sign-up button on one line on phones */
.header-signup { white-space: nowrap; gap: 0; }
@media (max-width: 560px) {
  .hide-phone { display: none; }
}

/* ============================ INTRO ============================ */
.shop-head { padding: 34px 0 6px; }
.shop-head h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  margin: 0 0 10px;
}
.shop-intro {
  color: var(--muted);
  max-width: 62ch;
  font-size: 1.04rem;
  margin: 0 0 16px;
}
.shop-intro a { font-weight: 600; }
.shop-note {
  display: inline-block;
  background: var(--surface);
  border: 1px solid rgba(232, 183, 58, 0.35);
  color: #d9d9d9;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 12px;
  margin: 0;
}
.shop-note a { color: var(--gold-soft); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.shop-note strong { color: var(--gold); }

/* ============================ FILTERS ============================ */
.shop-tools { padding: 18px 0 6px; background: var(--bg); }

.tools-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tools-search { grid-column: 1 / -1; position: relative; }

.field {
  width: 100%;
  min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: 500 16px/1.2 var(--font);   /* 16px: no zoom-on-focus on iOS */
  padding: 0 14px;
}
.field:hover { border-color: #3a3a3f; }
.field:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }

.field-search { padding-left: 42px; }
.field-search::placeholder { color: #6f6f6f; }
.field-search::-webkit-search-cancel-button { filter: invert(0.6); cursor: pointer; }
.tools-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.field-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  text-overflow: ellipsis;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239A9A9A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field-select.is-set { border-color: rgba(232, 183, 58, 0.6); color: var(--gold-soft); }
.field-select option { background: var(--surface); color: var(--text); }

/* Category chips: one swipeable row on phones, wrapping on wide screens */
.cat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 12px -20px 0;
  padding: 2px 20px 6px;
}
.cat-chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 600 14px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: rgba(232, 183, 58, 0.5); }
.chip-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1300; }
.chip[aria-pressed="true"] .chip-count { color: #4a3800; }
.chip:disabled { opacity: 0.45; cursor: default; }

@media (min-width: 720px) {
  .tools-row { grid-template-columns: minmax(0, 1fr) 230px 200px; }
  .tools-search { grid-column: auto; }
}

@media (min-width: 900px) {
  /* Wide screens: all categories visible at once. The bar scrolls away with the page
     (sticky, it took a quarter of a laptop screen); "Back to filters" brings you back. */
  .cat-chips { flex-wrap: wrap; overflow: visible; margin: 12px 0 0; padding: 0 0 4px; }
}

/* ============================ RESULTS ============================ */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 16px 0 12px;
}
.results-count { margin: 0; font-weight: 700; font-size: 15px; color: var(--text); }
.results-updated { margin: 0; font-size: 13px; color: var(--muted); }

.shop-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.shop-grid:focus { outline: none; }
@media (min-width: 640px) { .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Each grid item: the card on top, the quiet "Link broken?" button under it */
.shop-grid > li { display: flex; flex-direction: column; }
.shop-grid > li > .shop-card { flex: 1; height: auto; }
.shop-report {
  align-self: center;
  min-height: 30px;
  margin-top: 2px;
  padding: 4px 10px;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.7;
  cursor: pointer;
}
.shop-report:hover { color: var(--text); opacity: 1; }
a.shop-report { display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.shop-report:disabled { text-decoration: none; opacity: 0.9; cursor: default; }

/* The whole card is one link to Oopbuy: a big, easy tap target */
.shop-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--tile-radius);
  overflow: hidden;
  color: var(--text);
  transition: border-color 0.2s ease;
}
.shop-card:hover { color: var(--text); border-color: rgba(232, 183, 58, 0.45); }
.shop-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: var(--tile-radius); }

.shop-photo {
  position: relative;
  aspect-ratio: 1 / 1;                /* fixed square => no layout shift while photos load */
  overflow: hidden;
  background: var(--porcelain);
  display: grid;
  place-items: center;
}
.shop-photo img {                     /* absolute, so a tall photo can't stretch the square */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7%;
  mix-blend-mode: multiply;           /* white seller backgrounds melt into the Porcelain tile */
}
.shop-photo.is-missing::after {
  content: "No photo";
  color: #8a8a8a;
  font-size: 13px;
  font-weight: 500;
}

.shop-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px 12px;
}
.shop-price {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.shop-price .eur { margin-left: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.shop-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-cat { margin: 0; font-size: 13px; color: var(--muted); }
.shop-go {
  margin: auto 0 0;                   /* pushed to the bottom; no paragraph margin under it */
  padding-top: 10px;
}
.shop-go span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.shop-card:hover .shop-go span { border-color: var(--gold); background: rgba(232, 183, 58, 0.07); }

@media (max-width: 560px) {
  /* Two cards side by side: keep them short so more finds fit on one screen */
  .shop-body { gap: 2px; padding: 9px 10px 10px; }
  .shop-price { font-size: 16px; }
  .shop-price .eur { margin-left: 5px; font-size: 12px; }
  .shop-name { font-size: 14px; }
  .shop-cat { font-size: 12px; }
  .shop-go { padding-top: 8px; }
  .shop-go span { min-height: 36px; font-size: 13px; }
}

/* ============================ STATES ============================ */
.shop-status {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}
.shop-status p { margin: 0 0 16px; }
.shop-status p:last-child { margin-bottom: 0; }

.shop-more { display: flex; justify-content: center; padding: 28px 0 4px; }

.shop-fine {
  max-width: 62ch;
  margin: 28px 0 40px;
  font-size: 13px;
  color: #7a7a7a;
}

/* A way back up to the filters after a long scroll */
.to-filters {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 60;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.8);
}
.to-filters:hover { color: var(--text); border-color: var(--gold); }
@media (min-width: 900px) { .to-filters { right: 24px; bottom: 24px; } }
