/* Public bookstore storefront — feels like a local shop, not an admin tool. */

.sf-header { background: var(--store-header-bg, var(--sp-ink)); color: var(--store-header-text, #f1ebde); padding: 1.75rem 0 1.5rem; position: relative; overflow: hidden; }
.sf-header::after {
  content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(197, 139, 43, .28), transparent 70%); pointer-events: none;
}
.sf-header a { color: inherit; text-decoration: none; }
.sf-store { display: flex; align-items: center; gap: 1rem; }
/* Logos keep their aspect ratio but can't break the header: 64px tall max (44px on phones), width capped. */
.sf-logo { height: 64px; width: auto; min-width: 64px; max-width: 220px; border-radius: 14px; object-fit: contain; background: #fff; padding: 4px; flex: none; }
.sf-logo-fallback { width: 64px; height: 64px; border-radius: 14px; background: var(--sp-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--sp-font-display); font-size: 1.8rem; font-weight: 700; flex: none; }
.sf-store h1 { color: #fff; font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: 0; }
.sf-store .loc { color: var(--store-header-muted, #c9c2b2); font-size: .92rem; }
.sf-tagline { display: block; color: var(--store-header-muted, #c9c2b2); font-size: .95rem; line-height: 1.3; margin-top: .1rem; overflow-wrap: anywhere; }
.sf-search { margin-top: 1.4rem; position: relative; z-index: 1; }
.sf-search .form-control { border-radius: 999px; padding: .8rem 1.2rem .8rem 2.8rem; border: 0; font-size: 1rem; box-shadow: 0 4px 18px rgba(0, 0, 0, .18); }
.sf-search .bi-search { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--sp-muted); }
.sf-search .btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border-radius: 999px; }

.sf-intro { color: var(--sp-ink-2); max-width: 720px; font-size: 1.02rem; }
.sf-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.sf-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 999px; background: var(--sp-surface); border: 1px solid var(--sp-border); color: var(--sp-ink-2); text-decoration: none; font-size: .88rem; font-weight: 500; transition: all .15s; }
.sf-chip:hover { border-color: var(--sp-accent); color: var(--sp-ink); }
.sf-chip.active { background: var(--sp-ink); color: #fff; border-color: var(--sp-ink); }
.sf-chip .n { font-size: .74rem; color: var(--sp-muted); }
.sf-chip.active .n { color: #c9cfda; }

.sf-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; }
.sf-section-title h2 { font-size: 1.45rem; margin: 0; }

.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 1.4rem 1.1rem; }
@media (max-width: 575.98px) { .sf-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem .8rem; } }
.sf-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.sf-cover { aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden; position: relative; box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 10px 22px rgba(31, 42, 60, .14); transition: transform .2s ease, box-shadow .2s ease; background: var(--sp-bg-deep); }
.sf-card:hover .sf-cover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0, 0, 0, .12), 0 16px 30px rgba(31, 42, 60, .18); }
.sf-cover img { width: 100%; height: 100%; object-fit: cover; }
.sf-cover-ph { position: absolute; inset: 0; padding: 1rem .9rem; display: flex; flex-direction: column; justify-content: space-between; color: #fff; }
.sf-cover-ph::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, .18); }
.sf-cover-ph .t { font-family: var(--sp-font-display); font-weight: 600; font-size: 1.02rem; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.sf-cover-ph .a { font-size: .74rem; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.sf-ph-0 { background: linear-gradient(160deg, #2c3b55, #1a2436); }
.sf-ph-1 { background: linear-gradient(160deg, #a8721c, #7b520f); }
.sf-ph-2 { background: linear-gradient(160deg, #3b765a, #234a37); }
.sf-ph-3 { background: linear-gradient(160deg, #7d4a5d, #52303d); }
.sf-ph-4 { background: linear-gradient(160deg, #4f5f7a, #333f55); }
.sf-ph-5 { background: linear-gradient(160deg, #8a6a3f, #5e4524); }
.sf-meta { padding-top: .65rem; }
.sf-meta .t { font-weight: 600; color: var(--sp-ink); line-height: 1.25; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-meta .a { color: var(--sp-muted); font-size: .84rem; margin-top: .1rem; }
.sf-meta .d { font-size: .76rem; color: var(--sp-muted); margin-top: .25rem; }
.sf-meta .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: .35rem; }
.sf-price { font-weight: 700; color: var(--sp-forest); }
.sf-avail { font-size: .72rem; font-weight: 600; color: var(--sp-forest); background: var(--sp-forest-soft); padding: .12rem .5rem; border-radius: 999px; }
.sf-avail.low { color: var(--sp-warning); background: var(--sp-warning-soft); }

.sf-filters { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: var(--sp-radius); padding: 1.1rem; }
.sf-filters .form-label { font-size: .8rem; }

.sf-detail-cover { max-width: 320px; margin: 0 auto; }
.sf-detail-cover .sf-cover-ph .t { font-size: 1.6rem; -webkit-line-clamp: 6; }
.sf-cover-credit { margin-top: .4rem; font-size: .75rem; color: var(--sp-muted); text-align: center; }
.sf-cover-credit a { color: inherit; }
.sf-cover img.is-photo { object-fit: contain; background: var(--sp-bg-deep); }
.sf-photo-strip { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .75rem; }
.sf-photo-thumb { width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--sp-bg-deep); cursor: pointer; }
.sf-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sf-photo-thumb.is-active { border-color: var(--sp-accent, #a8721c); }
.sf-photo-thumb:focus-visible { outline: 2px solid var(--sp-accent, #a8721c); outline-offset: 2px; }
.sf-detail h1 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); margin-bottom: .2rem; }
.sf-detail .by { font-size: 1.1rem; color: var(--sp-ink-2); }
.sf-detail .price { font-family: var(--sp-font-display); font-size: 2rem; color: var(--sp-forest); font-weight: 600; }
.sf-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.sf-fact { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-sm); padding: .65rem .85rem; }
.sf-fact .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--sp-muted); font-weight: 600; }
.sf-fact .v { font-weight: 600; color: var(--sp-ink); font-size: .92rem; }
.sf-reserve-box { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: var(--sp-radius); padding: 1.25rem; box-shadow: var(--sp-shadow); }

.sf-footer { border-top: 1px solid var(--sp-border); margin-top: 4rem; padding: 2rem 0; font-size: .85rem; color: var(--sp-muted); }
.sf-footer a { color: var(--sp-ink-2); }
.sf-confirm { max-width: 560px; margin: 3rem auto; text-align: center; }
.sf-confirm .ic { width: 76px; height: 76px; border-radius: 50%; background: var(--sp-forest-soft); color: var(--sp-forest); display: inline-flex; align-items: center; justify-content: center; font-size: 2.3rem; margin-bottom: 1rem; }

/* ---------- responsive (phones first: shoppers arrive from Google, social links, texts and QR codes) */
.sf-store-name { color: var(--store-header-text, #fff); font-family: var(--sp-font-display); font-size: clamp(1.25rem, 5.5vw, 2.3rem); line-height: 1.15; overflow-wrap: anywhere; }
.sf-menu-btn { color: var(--store-header-text, #fff); border: 1px solid rgba(255, 255, 255, .25); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: none; }
.sf-menu-btn:hover, .sf-menu-btn:focus { color: var(--store-header-text, #fff); background: rgba(255, 255, 255, .1); }
.sf-chip { min-height: 44px; }
.sf-collects { white-space: pre-line; }
.sf-collects.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sf-sticky-reserve { display: none; }
@media (max-width: 767.98px) {
  .sf-header { padding: 1rem 0; }
  .sf-logo, .sf-logo-fallback { width: 44px; height: 44px; border-radius: 10px; font-size: 1.3rem; }
  .sf-logo { width: auto; min-width: 44px; max-width: 140px; }
  .sf-tagline { font-size: .82rem; }
  .sf-store { gap: .7rem; }
  .sf-store .loc { font-size: .82rem; }
  .sf-search { margin-top: .9rem; }
  .sf-search .form-control { font-size: 16px; padding: .75rem 6.2rem .75rem 2.6rem; }
  .sf-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: calc(-.5 * var(--bs-gutter-x, 1.5rem)); margin-right: calc(-.5 * var(--bs-gutter-x, 1.5rem)); padding: 0 calc(.5 * var(--bs-gutter-x, 1.5rem)) .25rem; }
  .sf-chips::-webkit-scrollbar { display: none; }
  .sf-chip { white-space: nowrap; flex: none; }
  .sf-section-title { margin: 1.5rem 0 .75rem; }
  .sf-section-title h2 { font-size: 1.25rem; }
  .sf-detail-cover { max-width: 210px; }
  .sf-detail .price { font-size: 1.7rem; }
  .sf-reserve-box .btn-lg { width: 100%; }
  .sf-facts { grid-template-columns: 1fr 1fr; }
  .sf-reserve-actions { display: grid !important; grid-template-columns: 1fr 2fr; gap: .5rem; }
  .sf-reserve-actions .btn { margin: 0; min-height: 48px; }
  .sf-sticky-reserve {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    padding: .65rem calc(1rem + env(safe-area-inset-right)) calc(.65rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
    background: rgba(255, 255, 255, .98); border-top: 1px solid var(--sp-border); box-shadow: 0 -6px 18px rgba(31, 42, 60, .1);
  }
  .sf-sticky-reserve .price-sm { font-family: var(--sp-font-display); font-weight: 600; color: var(--sp-forest); font-size: 1.2rem; line-height: 1.1; }
  .sf-sticky-reserve .btn { min-height: 48px; font-weight: 600; flex: none; }
  body:has(.sf-sticky-reserve) .sf-footer { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .sf-footer { margin-top: 2.5rem; }
}
/* Book grid: 2 columns on normal phones, 1 on very narrow, 3 on tablets, auto on desktop. */
@media (min-width: 576px) and (max-width: 991.98px) { .sf-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 339.98px) { .sf-grid { grid-template-columns: 1fr; } .sf-card { max-width: 220px; margin: 0 auto; width: 100%; } }
/* Filter drawer: bottom sheet below lg, sidebar card at lg+ (Bootstrap offcanvas-lg). */
@media (max-width: 991.98px) {
  .sf-filter-sheet.offcanvas-lg { height: auto !important; max-height: 88vh; max-height: 88dvh; border-radius: 18px 18px 0 0; }
  .sf-filter-sheet .offcanvas-body { overflow-y: auto; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .sf-filter-sheet .sf-filters { border: 0; padding: 0; background: none; }
  .sf-filter-sheet .form-control-sm, .sf-filter-sheet .form-select-sm { font-size: 16px; min-height: 44px; }
}
@media (min-width: 992px) { .sf-filter-sheet .offcanvas-body { display: block; padding: 0; } }

/* ==========================================================================================================
   Custom branding (StoreBrandingService). The theme only ever sets validated --store-* / --sp-* custom
   properties and body classes (sf-themed sf-btn-* sf-cards-* sf-corner-* sf-header-* sf-dark); every rule
   below falls back to the ShelfPilot default, so an unbranded store looks exactly as before.
   ========================================================================================================== */

/* ---------- hero banner (catalog home page) */
.sf-hero { position: relative; overflow: hidden; display: flex; align-items: center; min-height: clamp(210px, 28vw, 340px);
  background: var(--store-primary, var(--sp-ink)); color: #fff; }
.sf-hero[hidden] { display: none; }
.sf-hero-media { position: absolute; inset: 0; display: block; }
.sf-hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: var(--sf-hero-pos, center); display: block; }
.sf-hero-media img:not([src]) { display: none; }
.sf-hero::before, .sf-header-hero::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: rgba(0, 0, 0, var(--sf-hero-overlay, .4)); }
.sf-hero-text { position: relative; z-index: 2; padding-top: 2rem; padding-bottom: 2rem; }
.sf-hero-title { color: inherit; font-family: var(--sp-font-display); font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 0 0 .35rem; max-width: 760px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
.sf-hero-sub { font-size: clamp(1rem, 1.6vw, 1.15rem); margin: 0; max-width: 680px; opacity: .95; text-shadow: 0 1px 10px rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
/* No photo: a calm brand-colored band with readable text instead of an empty image box. */
.sf-hero-plain { min-height: 0; color: var(--store-primary-text, #fff); }
.sf-hero-plain::before { display: none; }
.sf-hero-plain .sf-hero-title, .sf-hero-plain .sf-hero-sub { text-shadow: none; }

/* ---------- header modes: light / dark / brand color / transparent over the hero photo */
.sf-header .sf-header-media, .sf-header .sf-hero-text-inline { display: none; }
.sf-header-light .sf-header { border-bottom: 1px solid var(--sp-border); }
.sf-header-light .sf-header::after { display: none; }
.sf-header-light .sf-menu-btn { border-color: var(--sp-border-strong); }
.sf-header-light .sf-logo { box-shadow: 0 0 0 1px var(--sp-border); }
.sf-header.sf-header-hero { color: #fff; padding: 2rem 0 1.75rem; min-height: clamp(300px, 34vw, 430px); display: flex; flex-direction: column; justify-content: flex-end; }
.sf-header.sf-header-hero::after { display: none; }
.sf-header.sf-header-hero .sf-header-media { display: block; }
.sf-header.sf-header-hero .sf-hero-text-inline { display: block; padding: 2.25rem 0 0; }
.sf-header.sf-header-hero .sf-store-name, .sf-header.sf-header-hero .sf-menu-btn { color: #fff; }
.sf-header.sf-header-hero .loc, .sf-header.sf-header-hero .sf-tagline { color: rgba(255, 255, 255, .88); }
.sf-header.sf-header-hero .container { position: relative; z-index: 2 !important; }

/* ---------- buttons: solid (default) / outline / soft, always with readable text */
.sf-themed .btn-accent {
  --bs-btn-bg: var(--store-accent); --bs-btn-border-color: var(--store-accent); --bs-btn-color: var(--store-button-text);
  --bs-btn-hover-bg: var(--store-accent-strong); --bs-btn-hover-border-color: var(--store-accent-strong); --bs-btn-hover-color: var(--store-button-text);
  --bs-btn-active-bg: var(--store-accent-strong); --bs-btn-active-border-color: var(--store-accent-strong); --bs-btn-active-color: var(--store-button-text);
}
.sf-themed .btn-primary {
  --bs-btn-bg: var(--store-primary); --bs-btn-border-color: var(--store-primary); --bs-btn-color: var(--store-primary-text);
  --bs-btn-hover-bg: var(--store-primary); --bs-btn-hover-border-color: var(--store-primary); --bs-btn-hover-color: var(--store-primary-text);
  --bs-btn-active-bg: var(--store-primary); --bs-btn-active-border-color: var(--store-primary); --bs-btn-active-color: var(--store-primary-text);
}
.sf-themed .btn-primary:hover { filter: brightness(1.12); }
.sf-btn-outline .btn-accent, .sf-btn-outline .btn-primary {
  --bs-btn-bg: transparent; --bs-btn-color: var(--store-accent-ink); --bs-btn-border-color: var(--store-accent-ink);
  --bs-btn-hover-bg: var(--store-accent); --bs-btn-hover-border-color: var(--store-accent); --bs-btn-hover-color: var(--store-button-text);
  border-width: 2px; filter: none;
}
.sf-btn-outline .sf-search .btn-accent { --bs-btn-bg: var(--sp-surface); }
.sf-btn-soft .btn-accent, .sf-btn-soft .btn-primary {
  --bs-btn-bg: var(--store-accent-soft); --bs-btn-border-color: var(--store-accent-soft); --bs-btn-color: var(--store-text);
  --bs-btn-hover-bg: var(--store-accent); --bs-btn-hover-border-color: var(--store-accent); --bs-btn-hover-color: var(--store-button-text);
  filter: none;
}
.sf-themed .sf-chip.active { background: var(--store-accent); border-color: var(--store-accent); color: var(--store-button-text); }
.sf-themed .sf-chip.active .n { color: inherit; opacity: .8; }
.sf-themed .sf-chip:hover { border-color: var(--store-accent); }
.sf-themed .sf-logo-fallback { background: var(--store-accent); color: var(--store-button-text); }

/* ---------- corners: square / slightly rounded / rounded */
.sf-themed .sf-cover { border-radius: var(--store-radius-sm); }
.sf-themed .sf-filters, .sf-themed .sf-reserve-box { border-radius: var(--store-radius); }
.sf-themed .sf-fact { border-radius: var(--store-radius-sm); }
.sf-themed .sf-logo { border-radius: var(--store-radius-sm); }
.sf-corner-square .sf-chip, .sf-corner-square .sf-search .form-control, .sf-corner-square .sf-search .btn, .sf-corner-square .sf-avail { border-radius: 0; }
.sf-corner-slight .sf-chip, .sf-corner-slight .sf-search .form-control, .sf-corner-slight .sf-search .btn { border-radius: 6px; }
.sf-corner-square .modal-content, .sf-corner-slight .modal-content { border-radius: var(--store-radius) !important; }

/* ---------- card style for book cards + storefront panels: clean (default) / bordered / elevated / minimal */
.sf-cards-bordered .sf-card, .sf-cards-elevated .sf-card { background: var(--sp-surface); border-radius: var(--store-radius); padding: .5rem .5rem .65rem; }
.sf-cards-bordered .sf-card { border: 1px solid var(--sp-border); }
.sf-cards-bordered .sf-cover { box-shadow: none; }
.sf-cards-bordered .sf-reserve-box { box-shadow: none; }
.sf-cards-elevated .sf-card { box-shadow: 0 2px 6px rgba(0, 0, 0, .08), 0 12px 28px rgba(0, 0, 0, .1); }
.sf-cards-elevated .sf-filters, .sf-cards-elevated .sf-fact, .sf-cards-elevated .sf-reserve-box { border-color: transparent; box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 10px 24px rgba(0, 0, 0, .08); }
.sf-cards-minimal .sf-cover { box-shadow: none; }
.sf-cards-minimal .sf-card:hover .sf-cover { transform: none; box-shadow: none; opacity: .92; }
.sf-cards-minimal .sf-filters, .sf-cards-minimal .sf-fact, .sf-cards-minimal .sf-reserve-box { box-shadow: none; background: transparent; }

/* ---------- dark backgrounds: keep inputs, sheets and dialogs readable */
.sf-dark .form-control, .sf-dark .form-select { background-color: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-strong); }
.sf-dark .form-control::placeholder { color: var(--sp-muted); }
.sf-dark .offcanvas, .sf-dark .modal-content { background: var(--sp-surface); color: var(--sp-text); }
.sf-dark .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.sf-dark .sf-sticky-reserve { background: var(--sp-surface); }
.sf-dark .text-body { color: var(--sp-text) !important; }
.sf-dark .sf-search .form-control { background-color: var(--sp-surface); }

/* ---------- focus stays visible whatever the colors (spec: branding must never hide keyboard focus) */
.sf-themed :focus-visible { outline: 3px solid var(--store-focus); outline-offset: 2px; }
.sf-themed .form-control:focus, .sf-themed .form-select:focus { border-color: var(--store-focus); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }

.sf-footer-name { color: var(--sp-text); }
.sf-footer-pickup { display: inline-block; max-width: 360px; }

@media (max-width: 767.98px) {
  .sf-hero { min-height: 190px; }
  .sf-hero-text { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .sf-header.sf-header-hero { min-height: 280px; padding: 1rem 0 1.1rem; }
  .sf-header.sf-header-hero .sf-hero-text-inline { padding-top: 1.5rem; }
}
