/* =====================================================================
   Shops module — the shelf & the page-turning reader
   Extends the Community Services app.css design system.
   Each shop is its own little book; a catalog is a shelf of books.
   ===================================================================== */

/* ---------- shelf (index.html) ---------- */

.shelf-sect { margin-bottom: 2.2rem; }
.shelf-sect .sect-ico {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand-deep);
  display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0;
}

.book {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  min-height: 168px;
  overflow: hidden;
  color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.book:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.book .book-spine {
  width: 22px; flex-shrink: 0;
  box-shadow: inset -3px 0 6px rgb(0 0 0 / .25);
  display: grid; place-items: start center; padding-top: 14px;
  color: rgb(255 255 255 / .85); font-size: .95rem;
}
.book .book-body { padding: 18px 18px 16px; flex-grow: 1; min-width: 0; }
.book .book-body .b-kind { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.book .book-body h3 { font-size: 1.15rem; font-weight: 800; margin: 6px 0 6px; letter-spacing: -.02em; }
.book .book-body p { color: var(--muted); margin: 0; font-size: .95rem; line-height: 1.5; }
.book .book-body .b-meta { margin-top: 10px; font-size: .85rem; color: var(--muted); }

/* ---------- reader (book.html) ---------- */
/* The paper engine is StPageFlip (vendored, MIT). Pages are real DOM
   paper, turned in 3D - tap the page, drag a corner, or swipe.
   The book is one page at a time, sized to the viewport, so nothing
   overflows a phone screen (no two-page spread to squeeze). */

.reader-shell {
  display: flex; flex-direction: column; align-items: center;
  max-width: 100%;
  overflow-x: clip;
}

.book-stage {
  position: relative;
  width: min(92vw, 400px);
  height: clamp(300px, 68vh, 560px);
  margin-inline: auto;
}

.paper-book {
  width: 100%; height: 100%;
}
.paper-book .stf__parent,
.paper-book .stf__wrapper,
.paper-book .stf__block { background: transparent; }

/* a paper page - warm sheet, deckled inner edge, soft spine shadow */
.shp {
  position: relative;
  box-sizing: border-box;
  width: 100%; height: 100%;
  background:
    radial-gradient(120% 90% at 30% 0%, rgb(255 255 255 / .8), rgb(255 255 255 / 0) 60%),
    var(--paper-warm, #fdfaf3);
  border: 2px solid #e6e0d4;
  border-radius: 10px;
  box-shadow: inset 4px 0 10px rgb(0 0 0 / .06);
  padding: clamp(18px, 4.5vw, 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex; flex-direction: column;
  color: var(--ink);
  font-size: 1rem; line-height: 1.6;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* the binding shadow along the spine */
.shp::before {
  content: "";
  position: absolute; top: 10px; bottom: 10px; left: 10px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, rgb(0 0 0 / .06), rgb(0 0 0 / .14), rgb(0 0 0 / .06));
  pointer-events: none;
}

.shp .pg-kicker {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.shp .pg-kicker .rule { flex-grow: 1; height: 2px; background: var(--line); }
.shp h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 10px; }
.shp .pg-body { font-size: 1rem; line-height: 1.65; color: var(--ink); flex-grow: 1; }
.shp .pg-body p { margin: 0 0 12px; }

/* a page can be a linktree too: tappable paper cards (neighborhood group pages) */
.pg-links {
  margin-top: 14px; display: grid; gap: 10px;
}
.pg-link {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; background: var(--wash);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--ink); box-shadow: var(--shadow-sm);
  min-height: var(--tap-min);
}
.pg-link:hover, .pg-link:focus { border-color: var(--brand); background: #fff; }
.pg-link .lnk-ico {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.15rem;
  background: var(--brand-soft); color: var(--brand);
}
.pg-link .lnk-text { display: flex; flex-direction: column; min-width: 0; }
.pg-link .lnk-title { font-weight: 800; font-size: 1rem; line-height: 1.4; }
.pg-link .lnk-note { font-weight: 400; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.pg-link .chev { margin-left: auto; color: var(--muted); flex-shrink: 0; }
.pg-links-dark .pg-link {
  background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .22); color: #fff;
}
.pg-links-dark .pg-link:hover { background: rgb(255 255 255 / .16); }
.pg-links-dark .pg-link .lnk-ico { background: rgb(255 255 255 / .15); color: #fff; }
.pg-links-dark .pg-link .lnk-note, .pg-links-dark .pg-link .chev { color: rgb(255 255 255 / .75); }

.pg-meta {
  margin-top: auto; padding-top: 14px;
  font-size: .8rem; color: var(--muted);
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.pg-price {
  background: var(--good-soft); color: var(--good);
  border-radius: 999px; padding: .35em .9em;
  font-weight: 800; font-size: .95rem; white-space: nowrap;
}
.pg-price.trade, .pg-price.free { background: var(--accent-soft); color: #92400e; }
.pg-hand { font-size: .82rem; }

/* cover page - a paper page dressed in the shopkeeper's colours */
.shp-cover {
  background:
    radial-gradient(140% 100% at 100% 0%, rgb(255 255 255 / .14), transparent 55%),
    linear-gradient(160deg, #00000066, transparent 40%),
    var(--cov, var(--brand));
  color: #fff;
  border-color: rgb(0 0 0 / .2);
  box-shadow: none;
  justify-content: center; text-align: center;
}
.shp-cover::before {
  content: "";
  position: absolute; top: 12px; bottom: 12px; left: 14px; right: 14px;
  border: 2px solid rgb(255 255 255 / .22); border-radius: 8px;
  pointer-events: none;
}
.shp-cover .cover-in { position: relative; z-index: 1; display: flex; flex-direction: column; flex-grow: 1; }
.shp-cover .c-icon {
  width: 64px; height: 64px; margin: 0 auto;
  border-radius: 16px; background: rgb(255 255 255 / .16);
  display: grid; place-items: center; font-size: 1.9rem; color: #fff;
}
.shp-cover .c-group { margin-top: 14px; font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgb(255 255 255 / .72); }
.shp-cover h2 { color: #fff; margin: 8px 0 6px; font-size: 1.7rem; line-height: 1.15; }
.shp-cover .c-owner { font-size: .95rem; color: rgb(255 255 255 / .85); }
.shp-cover .c-blurb { margin-top: auto; font-size: .98rem; line-height: 1.55; color: rgb(255 255 255 / .92); padding-bottom: 8px; }
.shp-cover .c-open {
  margin-top: 12px; font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgb(255 255 255 / .8);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* scan pages - a whole paper sheet per page (journals, photobooks).
   A real scan is an image braced to the sheet; a placeholder sheet is
   ruled paper with the faintest pen-and-ink, page number in the corner,
   so a 100+ page journal reads as leaves, not a list. */
.shp-scan {
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #fbf7ee;
  justify-content: center;
}
.shp-scan::before { display: none; }
.scan-sheet {
  position: relative;
  width: 100%; height: 100%;
  display: grid; place-items: center;
  overflow: hidden;
}
.scan-img { width: 100%; height: 100%; object-fit: contain; display: block; background: #f2eddf; }
.scan-ruled {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 34px, rgb(92 64 51 / .07) 34px 36px);
  opacity: .8;
}
.scan-art { font-size: 3rem; color: rgb(92 64 51 / .14); }
.scan-num {
  position: absolute; bottom: 14px; right: 16px;
  font-size: .78rem; font-weight: 800; letter-spacing: .12em;
  color: rgb(92 64 51 / .32); font-variant-numeric: tabular-nums;
}
.scan-cap {
  position: absolute; top: 12px; left: 16px;
  font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgb(92 64 51 / .38);
}

/* back cover */
.shp-back {
  background:
    radial-gradient(120% 90% at 20% 100%, rgb(255 255 255 / .1), transparent 55%),
    var(--cov, var(--brand-deep));
  color: #fff;
  border-color: rgb(0 0 0 / .25);
  box-shadow: none;
  justify-content: flex-end; text-align: center;
}
.shp-back h2 { color: #fff; }
.shp-back .pg-body, .shp-back .pg-body p { color: rgb(255 255 255 / .88); font-size: .92rem; }
.shp-back .c-group { font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgb(255 255 255 / .7); margin-bottom: 8px; }

/* reader controls */
.flip-controls { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.flip-tap { width: 64px; }
.flip-ctr { min-height: var(--tap-min); min-width: var(--tap-min); }
.flip-progress { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.flip-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.flip-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background .15s ease; }
.flip-dots .dot:hover { background: var(--brand-2); }
.flip-dots .dot.on { background: var(--brand); }

.deck-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.deck-top .dt-title { font-weight: 800; letter-spacing: -.02em; font-size: 1rem; }
.deck-top .dt-meta { font-size: .82rem; color: var(--muted); }

/* ---------- set-aside strip on offer pages ---------- */
.pg-act {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.qty-ctl {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--wash); border: 2px solid var(--line);
  border-radius: 999px; padding: 2px;
}
.qty-btn {
  width: var(--tap-min); height: var(--tap-min); border: 0; background: transparent;
  border-radius: 50%; font-size: 1.3rem; font-weight: 800; color: var(--brand);
  line-height: 1; cursor: pointer;
}
.qty-btn:hover { background: var(--brand-soft); }
.qty-btn:disabled { opacity: .3; cursor: default; }
.qty-now {
  min-width: 2.2em; text-align: center; font-weight: 800;
  font-variant-numeric: tabular-nums; font-size: 1.05rem;
}

/* ---------- basket chip (reader nav) ---------- */
.basket-chip { position: relative; }
.basket-chip .badge-soft {
  background: var(--accent-soft); color: #92400e; border-radius: 999px;
  padding: .1em .55em; font-weight: 800; font-size: .82rem; font-variant-numeric: tabular-nums;
}

/* ---------- the order form page (near the back of every book) ---------- */
.shp-order { justify-content: flex-start; }
.shp-order h2 { margin-bottom: 14px; }
.order-lines { margin-bottom: 14px; }
.order-line {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.order-line .o-qty {
  flex-shrink: 0; min-width: 3.2em; font-weight: 800; font-size: .9rem; color: var(--brand);
}
.order-line .o-name { flex-grow: 1; min-width: 0; font-size: .95rem; line-height: 1.35; }
.order-line .o-name .o-book { display: block; font-size: .78rem; }
.order-line .o-price {
  flex-shrink: 0; font-weight: 700; font-size: .88rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.order-empty { color: var(--muted); font-style: italic; }
.order-note {
  margin-top: 12px; font-size: .78rem; color: var(--muted); line-height: 1.5;
  display: flex; gap: 6px; align-items: flex-start;
}
.order-cta {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.order-tally { font-size: .92rem; font-weight: 700; color: var(--brand-deep); }