/* Demo wholesale store: archival-index catalog, cart drawer, demo checkout */

.shop-header {
  position: sticky;
  top: var(--ribbon-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.shop-header .brand img { height: 54px; width: auto; }
.searchwrap { flex: 1; max-width: 440px; }
.searchwrap input {
  width: 100%;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.searchwrap input::placeholder { color: var(--muted); }
.cart-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.cart-count {
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}
.cart-count.bump { animation: badge-bump 0.28s ease; }
@keyframes badge-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .cart-count.bump { animation: none; }
}
html.flat .cart-count.bump { animation: none; }

/* Returning-customer strip */
.route-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1220px;
  margin: 0 auto;
  padding: 9px 22px;
  font-size: 13.5px;
  color: var(--maroon);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.route-strip-right { display: inline-flex; align-items: center; gap: 18px; }
.route-strip a { color: var(--muted); font-weight: 500; }
.route-strip-btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  background: none;
  color: var(--maroon);
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 0;
}

.shop-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 34px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 22px 90px;
}

/* Group filter */
.groups {
  position: sticky;
  top: calc(var(--ribbon-h) + 86px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.group-btn {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  font: inherit;
  font-size: 15px;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 0 6px 6px 0;
}
.group-btn:hover { background: rgba(48, 35, 16, 0.05); }
.group-btn.is-active {
  border-left-color: var(--gold);
  background: var(--paper);
  font-weight: 600;
}
.group-btn .n {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Catalog: archival index */
.catalog { min-width: 0; }
.shop-title { margin: 4px 0 2px; font-size: 30px; }
.shop-sub { margin: 0 0 22px; color: var(--muted); font-size: 14.5px; }

.cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 34px 0 0;
  padding: 0 10px 8px;
  border-bottom: 2px solid var(--ink);
  font-size: 16.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.cat-head:first-child { margin-top: 0; }
.cat-head .n {
  font-family: var(--body);
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.prow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px 18px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  background: transparent;
}
.prow.in-cart {
  border-left-color: var(--maroon);
  background: var(--paper);
}
.pname { font-weight: 500; font-size: 15.5px; }
.pmeta {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.pmeta .pbrand { text-transform: uppercase; }
.rowline {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--maroon);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.pchip {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: #8A5A00;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}
.pprice {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 15.5px;
  text-align: right;
  min-width: 76px;
}
.pqty { display: inline-flex; align-items: stretch; }
.pqty button {
  width: 34px;
  height: 34px;
  font-size: 19px;
  line-height: 1;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.pqty .qminus { border-radius: 6px 0 0 6px; }
.pqty .qplus { border-radius: 0 6px 6px 0; }
.pqty button:hover { background: var(--cream); }
.pqty input {
  width: 44px;
  height: 34px;
  border: 1px solid var(--line-dark);
  border-left: 0;
  border-right: 0;
  text-align: center;
  font: inherit;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.pqty input::-webkit-outer-spin-button,
.pqty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.empty-state {
  padding: 60px 10px;
  text-align: center;
  color: var(--muted);
}
.empty-state button {
  font: inherit;
  border: 0;
  background: none;
  color: var(--maroon);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Cart drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(48, 35, 16, 0.45);
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: min(430px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(48, 35, 16, 0.25);
}
.cart-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid var(--ink);
}
.cart-drawer > header h2 { margin: 0; font-size: 20px; }
.icon-btn {
  font: inherit;
  font-size: 15px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
}
.icon-btn:hover { color: var(--ink); }
.cart-lines { flex: 1; overflow-y: auto; padding: 6px 20px; }
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line .pqty { margin-top: 5px; }
.cart-line-name { font-weight: 500; font-size: 14.5px; }
.cart-line-meta { font-size: 12px; color: var(--muted); }
.cart-line-total {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.cart-empty { padding: 40px 0; text-align: center; color: var(--muted); }

.cart-meter { padding: 12px 20px 0; font-size: 13.5px; }
.cart-meter .bar {
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.cart-meter .fill {
  height: 100%;
  background: var(--gold);
  transition: width 0.2s ease;
}
.cart-meter.unlocked { color: #245A2E; font-weight: 600; }
.cart-meter.unlocked .fill { background: #2E7A3C; }

.cart-drawer > footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}
.cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.cart-drawer .btn { width: 100%; }
.cart-clear {
  width: 100%;
  margin-top: 8px;
  font: inherit;
  font-size: 13.5px;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

/* Checkout overlay */
.checkout {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  background: rgba(48, 35, 16, 0.5);
  padding: 30px 16px;
}
.checkout-panel {
  max-width: 680px;
  margin: 0 auto;
  background: var(--cream);
  border-radius: 10px;
  padding: 30px clamp(20px, 4vw, 40px) 36px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}
.checkout-panel h2 { font-size: 26px; margin-bottom: 4px; }
.checkout-close { float: right; margin-top: -6px; }
.demo-note {
  margin: 14px 0 22px;
  padding: 12px 16px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 153, 0, 0.09);
  font-size: 14.5px;
}
.co-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 8px;
}
.co-fields label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.co-fields input, .co-fields select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.12s ease;
}
.co-fields input:hover, .co-fields select:hover { border-color: var(--maroon); }
.co-fields input:not(:placeholder-shown):valid { border-color: #2E7A3C; }
.route-note {
  grid-column: 1 / -1;
  min-height: 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--maroon);
}
.co-summary { margin: 18px 0 20px; }
.co-summary h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; }
.co-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.co-table th {
  text-align: left;
  padding: 10px 8px 5px;
  border-bottom: 2px solid var(--ink);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.co-table th.r, .co-table td.r { text-align: right; font-variant-numeric: tabular-nums; }
.co-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.co-table .cat-row td {
  padding-top: 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 0;
}
.co-table tfoot td {
  padding-top: 12px;
  font-weight: 700;
  font-size: 15.5px;
  border-bottom: 0;
}
.confirm-ref {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.03em;
  margin: 6px 0 2px;
}
.stamp {
  display: inline-block;
  transform: rotate(-4deg);
  border: 3px solid var(--maroon);
  border-radius: 6px;
  color: var(--maroon);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 14px;
  margin: 4px 0 14px;
  opacity: 0.85;
}
.cart-empty-last { margin-top: 14px; }
.load-last-inline {
  font: inherit;
  font-weight: 600;
  border: 0;
  background: none;
  color: var(--maroon);
  text-decoration: underline;
  cursor: pointer;
}
.confirm-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

@media (max-width: 860px) {
  .shop-layout {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 14px;
  }
  .groups {
    position: sticky;
    top: calc(var(--ribbon-h) + 62px);
    z-index: 40;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 0;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
  }
  .group-btn {
    flex: 0 0 auto;
    width: auto;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    padding: 9px 15px;
    min-height: 44px;
  }
  .group-btn.is-active {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--cream);
  }
  .group-btn.is-active .n { color: var(--gold); }
  .shop-header { gap: 10px; padding: 8px 14px; flex-wrap: wrap; }
  .shop-header .brand img { height: 44px; }
  .searchwrap { order: 3; flex-basis: 100%; max-width: none; }
  .prow { grid-template-columns: 1fr auto; }
  .pprice { grid-column: 1; text-align: left; min-width: 0; }
  .pqty { grid-row: 1 / 3; grid-column: 2; align-self: center; }
  .pqty button { width: 42px; height: 44px; }
  .pqty input { height: 44px; }
  .co-fields { grid-template-columns: 1fr; }
}

/* Print: confirmation acts as the order sheet */
@media print {
  .demo-ribbon, .shop-header, .shop-layout, .drawer-backdrop, .cart-drawer { display: none !important; }
  .checkout { position: static; background: none; padding: 0; }
  .checkout-panel { box-shadow: none; border-radius: 0; max-width: none; }
  .confirm-actions, .checkout-close { display: none !important; }
  body { background: #fff; }
}
