/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px;
  background: rgba(10, 9, 7, .98); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ivory); text-decoration: none; }
.brand img { height: 38px; width: auto; }
.brand b { font: 400 28px/1 var(--serif); letter-spacing: .01em; }
.cart-btn { gap: 12px; }
.cart-btn .count {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
  background: var(--brass); color: var(--ebony); font-size: 13px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.cart-btn .total { color: var(--ivory); }

.demo-note {
  background: #2a2112; color: var(--brass-hi); text-align: center;
  font-size: 13px; padding: 6px 16px; border-bottom: 1px solid var(--line);
}

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center;
  max-width: 1320px; margin: 0 auto; padding: 56px 24px 64px;
}
.hero h1 { font: 400 clamp(44px, 5.4vw, 78px)/.98 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.hero .lede { margin-top: 18px; max-width: 34ch; color: var(--dust); font-size: 18px; }
.finder {
  margin-top: 32px; padding: 20px; max-width: 460px;
  background: var(--lacquer); border: 1px solid var(--line); border-radius: 10px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.finder .wide { grid-column: 1 / -1; }
.finder .btn { grid-column: 1 / -1; }
.finder-status { grid-column: 1 / -1; font-size: 14px; color: var(--moss); }
.hero-photo { position: relative; margin: 0; }
.hero-photo::before {
  content: ''; position: absolute; inset: 18px -18px -18px 18px;
  border: 1px solid var(--brass); border-radius: 10px; opacity: .7;
}
.hero-photo img {
  position: relative; width: 100%; aspect-ratio: 1315 / 800; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
}
.hero-photo figcaption { position: relative; margin-top: 34px; font-size: 13px; color: var(--dust); }

/* ---------- filter bar ---------- */
.filters {
  position: sticky; top: 59px; z-index: 20;
  background: rgba(10, 9, 7, .98); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.filters-in {
  max-width: 1320px; margin: 0 auto; padding: 10px 24px;
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line); color: var(--ivory); white-space: nowrap;
}
.chip small { color: var(--dust); margin-left: 6px; }
.chip[aria-pressed="true"] { background: var(--brass); border-color: var(--brass); color: var(--ebony); font-weight: 600; }
.chip[aria-pressed="true"] small { color: var(--ebony); opacity: .7; }
.search { flex: none; width: 220px; }
.search input {
  width: 100%; min-height: 38px; padding: 0 12px;
  background: var(--lacquer); border: 1px solid var(--line); border-radius: 6px;
}
.search input:focus { border-color: var(--brass); outline: none; }

.date-pill {
  max-width: 1320px; margin: 0 auto; padding: 12px 24px 0;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 15px; color: var(--moss);
}
.date-pill button { background: none; border: 0; color: var(--brass-hi); text-decoration: underline; padding: 0; }
.date-pill.warn { color: var(--brass-hi); }

/* ---------- product grid ---------- */
.shelf { max-width: 1320px; margin: 0 auto; padding: 24px 24px 120px; }
.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  display: flex; flex-direction: column;
  background: var(--linen); color: var(--ink);
  border: 1px solid rgba(212, 162, 76, .6); border-radius: 12px; overflow: hidden;
}
.card-photo { padding: 0; border: 0; background: #000; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card-photo:hover img { transform: scale(1.03); }
.plate { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.plate h3 { font: 400 26px/1.1 var(--serif); }
.plate .rate { font-weight: 700; }
.plate .per { color: #6c6552; }
.avail { font-size: 14px; color: #5a5442; }
.avail.ok { color: #2e6b44; }
.avail.low { color: #9a5a14; }
.avail.out { color: #a2402f; }
.plate .act { margin-top: auto; padding-top: 12px; }
.card .btn { border-color: var(--ink); color: var(--ink); width: 100%; }
.card .btn.solid { background: var(--ink); color: var(--linen); }
.card .btn.solid:hover { background: #2b261c; }
.card .btn[disabled] { border-color: #b8ae92; color: #8a8167; background: transparent; }

.stepper { display: grid; grid-template-columns: 46px 1fr 46px; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; }
.stepper button { border: 0; background: transparent; font-size: 22px; min-height: 44px; color: inherit; }
.stepper button:hover { background: rgba(23, 20, 15, .08); }
.stepper input {
  width: 100%; border: 0; text-align: center; font-weight: 700; font-size: 17px;
  background: transparent; color: inherit; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.dark { border-color: var(--line); }
.stepper.dark button:hover { background: rgba(255, 255, 255, .06); }
.stepper.small { grid-template-columns: 34px 54px 34px; }
.stepper.small button { min-height: 34px; font-size: 18px; }

.empty { padding: 60px 0; text-align: center; color: var(--dust); }

/* ---------- cart drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.cart {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 100%);
  background: var(--lacquer); border-left: 1px solid var(--brass-dim);
  display: flex; flex-direction: column; transform: translateX(102%); transition: transform .25s;
}
.cart.on { transform: none; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font: 400 30px/1 var(--serif); }
.icon-btn { width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: transparent; font-size: 20px; line-height: 1; }
.cart-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-ctx { font-size: 14px; color: var(--dust); padding: 10px 0 4px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.line img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.line h4 { margin: 0; font: 400 20px/1.15 var(--serif); }
.line .sub { font-size: 13px; color: var(--dust); }
.line .row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.line .amt { text-align: right; font-weight: 600; }
.line .rm { background: none; border: 0; color: var(--dust); text-decoration: underline; font-size: 13px; padding: 0; }
.cart-foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; display: grid; gap: 8px; background: var(--ebony); }
.sum { display: flex; justify-content: space-between; gap: 12px; }
.sum.big { font-size: 20px; font-weight: 700; }
.sum.muted { color: var(--dust); font-size: 15px; }
.sum.adv { color: var(--brass-hi); font-weight: 600; }
.cart-note { font-size: 13px; color: var(--dust); }
.cart-empty { padding: 48px 8px; text-align: center; color: var(--dust); }

.cartbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 25;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 18px; border-radius: 10px;
  background: var(--brass); color: var(--ebony); border: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.cartbar b { font-size: 17px; }
.cartbar span { font-size: 14px; }
.cartbar .go { background: var(--ebony); color: var(--brass-hi); border-radius: 6px; padding: 10px 16px; font-weight: 600; }

/* ---------- detail dialog ---------- */
dialog.detail {
  width: min(880px, calc(100% - 24px)); padding: 0; border: 1px solid var(--brass); border-radius: 12px;
  background: var(--linen); color: var(--ink); overflow: hidden;
}
dialog.detail::backdrop { background: rgba(0, 0, 0, .75); }
.detail-in { display: grid; grid-template-columns: 1.3fr 1fr; }
.detail-in img { width: 100%; height: 100%; min-height: 320px; object-fit: cover; }
.detail-info { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.detail-info h2 { font: 400 38px/1.05 var(--serif); }
.detail-info .act { margin-top: auto; padding-top: 16px; }
.detail .close { position: absolute; top: 10px; right: 10px; background: rgba(10, 9, 7, .7); color: var(--ivory); border-color: transparent; z-index: 2; }

/* ---------- checkout ---------- */
.checkout { position: fixed; inset: 0; z-index: 60; background: var(--ebony); overflow-y: auto; }
.co-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.co-wrap { max-width: 1040px; margin: 0 auto; padding: 28px 24px 80px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.steps { display: flex; gap: 22px; margin-bottom: 22px; flex-wrap: wrap; }
.steps li { list-style: none; color: var(--dust); display: flex; gap: 8px; align-items: center; }
.steps li b { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; }
.steps li.on { color: var(--ivory); }
.steps li.on b { background: var(--brass); border-color: var(--brass); color: var(--ebony); }
.steps li.done b { border-color: var(--brass); color: var(--brass); }
.steps { padding: 0; }
.co-wrap h1 { font: 400 44px/1.05 var(--serif); margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.side { position: sticky; top: 20px; background: var(--lacquer); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 10px; }
.side h2 { font: 400 26px/1 var(--serif); margin-bottom: 6px; }
.side .mini { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ivory); }
.side .mini span:first-child { color: var(--dust); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.pay-box { background: var(--lacquer); border: 1px solid var(--brass-dim); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.pay-amount { font: 400 56px/1 var(--serif); color: var(--brass-hi); }
.pay-rows { margin-top: 14px; display: grid; gap: 8px; }
.pay-rows div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.pay-rows span:first-child { color: var(--dust); }
.pay-rows b { text-align: right; word-break: break-all; }
.proof-prev { margin-top: 10px; max-height: 180px; border-radius: 6px; border: 1px solid var(--line); }
.done-box { text-align: left; max-width: 640px; margin: 0 auto; padding: 56px 24px; }
.done-box h1 { font: 400 56px/1 var(--serif); }
.done-no { margin: 18px 0; display: inline-block; padding: 10px 16px; border: 1px solid var(--brass); border-radius: 6px; font-size: 22px; letter-spacing: .04em; color: var(--brass-hi); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90;
  background: var(--ivory); color: var(--ink); padding: 10px 18px; border-radius: 8px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5); max-width: calc(100% - 32px);
}

.foot { border-top: 1px solid var(--line); padding: 32px 24px 100px; text-align: center; color: var(--dust); font-size: 14px; }
.foot a { color: var(--brass-hi); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 24px 16px 40px; }
  .hero-photo { order: -1; }
  .hero-photo::before { inset: 10px -8px -10px 8px; }
  .finder { max-width: none; }
  .topbar { padding: 8px 14px; }
  .cart-btn .total { display: none; }
  .filters { top: 55px; }
  .filters-in { padding: 6px 14px; flex-direction: column; align-items: stretch; gap: 6px; }
  .chip { min-height: 34px; padding: 0 13px; font-size: 14px; }
  .search { width: 100%; }
  .search input { min-height: 34px; }
  .shelf { padding: 16px 14px 120px; }
  .date-pill { padding: 10px 14px 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .plate { padding: 12px; }
  .plate h3 { font-size: 21px; }
  .cartbar { display: flex; }
  .cartbar[hidden] { display: none !important; }
  .detail-in { grid-template-columns: 1fr; }
  .detail-in img { min-height: 220px; max-height: 280px; }
  .co-wrap { grid-template-columns: 1fr; padding: 20px 16px 80px; gap: 24px; }
  .side { position: static; order: -1; }
  .form-grid { grid-template-columns: 1fr; }
  .co-wrap h1, .done-box h1 { font-size: 38px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .card-photo { aspect-ratio: 16 / 10; }
  .finder { grid-template-columns: 1fr 1fr; padding: 16px; }
}

/* carpets: length x width boxes */
.sizebox { display: grid; gap: 8px; margin-top: 6px; }
.size-in { display: flex; align-items: flex-end; gap: 6px; }
.size-in label { display: grid; gap: 3px; font-size: 12px; flex: 1; min-width: 0; }
.size-in input { width: 100%; min-height: 40px; border: 1.5px solid var(--ivory, #17140f); border-radius: 6px; padding: 0 8px; font-size: 16px; background: transparent; color: inherit; box-sizing: border-box; }
.size-in .x { padding-bottom: 10px; font-size: 16px; }
.size-area { margin: 0; font-size: 13px; font-weight: 600; }
.size-btns { display: flex; align-items: center; gap: 12px; }
.size-or { margin: 0; font-size: 12px; opacity: .7; }
.size-direct { display: grid; gap: 3px; font-size: 12px; }
.size-direct input { width: 100%; min-height: 40px; border: 1.5px solid var(--ivory, #17140f); border-radius: 6px; padding: 0 8px; font-size: 16px; background: transparent; color: inherit; box-sizing: border-box; }
