/* Base Origin 3D shop page (shop.html). Uses the colours and buttons from style.css. */
.shop-page { overflow: hidden; height: 100vh; height: 100dvh; }
.shop-page.is-2d { overflow: auto; height: auto; }
.shop-page::before { z-index: 1; }
.btn-sm { padding: 9px 16px; font-size: 14px; }

/* Top bar */
.shop-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(rgba(13,11,10,.85), rgba(13,11,10,0));
  pointer-events: none;
}
.shop-bar > * { pointer-events: auto; }
.shop-bar__right { display: flex; align-items: center; gap: 10px; }
.chip, .basket-btn, .shop-exit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px; font-size: 14px; line-height: 1;
  border: 1px solid var(--gold-line); background: rgba(28,25,23,.72); color: var(--ivory);
  cursor: pointer; text-decoration: none; backdrop-filter: blur(6px);
}
.chip:hover, .basket-btn:hover, .shop-exit:hover { border-color: var(--gold); }
.basket-btn svg { width: 18px; height: 18px; }
.basket-btn b { min-width: 22px; padding: 3px 6px; border-radius: 999px; background: var(--gold); color: var(--brown); font-weight: 500; font-size: 12px; text-align: center; }
.basket-btn b.is-empty { background: rgba(184,151,106,.25); color: var(--ivory); }

/* 3D stage */
.stage { position: fixed; inset: 0; z-index: 0; background: #0d0b0a; }
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; outline: none; }
.stage canvas:active { cursor: grabbing; }
.is-2d .stage { display: none; }

.loading {
  position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: #0d0b0a; color: var(--ivory-dim); font-size: 15px; letter-spacing: .04em;
}
.loading[hidden] { display: none; }
.loading__ring { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(184,151,106,.2); border-top-color: var(--gold); animation: bo-spin 1s linear infinite; }
@keyframes bo-spin { to { transform: rotate(360deg); } }

/* Entrance */
.entrance {
  position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, rgba(13,11,10,.35), rgba(13,11,10,.88) 70%);
}
.entrance[hidden] { display: none; }
.is-2d .entrance { background: rgba(13,11,10,.92); }
.entrance__card { width: min(680px, 100%); text-align: center; }
.entrance__card > img { margin: 0 auto 18px; }
.entrance h1 { font-size: clamp(32px, 5vw, 54px); margin-bottom: 30px; }
.entrance__doors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.door {
  display: grid; gap: 8px; padding: 30px 22px 26px; text-align: left; cursor: pointer;
  border-radius: var(--radius-md); border: 1px solid var(--gold-line);
  background: linear-gradient(180deg, rgba(46,41,37,.92), rgba(28,25,23,.92)); color: var(--ivory);
  transition: border-color .2s, transform .2s;
  position: relative; overflow: hidden;
}
.door::after { content: ""; position: absolute; inset: auto 22px 0 22px; height: 3px; background: var(--gold); transform: scaleX(.15); transform-origin: left; transition: transform .3s; }
.door:hover { border-color: var(--gold); transform: translateY(-2px); }
.door:hover::after, .door:focus-visible::after { transform: scaleX(1); }
.door strong { font-size: 21px; font-weight: 500; }
.door span { font-size: 15px; color: var(--ivory-dim); }
.entrance__note { margin-top: 20px; font-size: 14px; color: var(--ivory-dim); }

/* HUD */
.hud { position: fixed; inset: auto 0 0 0; z-index: 20; padding: 0 20px max(18px, env(safe-area-inset-bottom)); pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.hud[hidden] { display: none; }
.hud > * { pointer-events: auto; }
.hud__jump { grid-column: 2; display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: rgba(28,25,23,.8); border: 1px solid var(--gold-line); backdrop-filter: blur(6px); }
.hud__jump button { border: 0; background: none; color: var(--ivory); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.hud__jump button:hover { background: rgba(184,151,106,.18); }
.hud__ask { grid-column: 3; justify-self: end; }
.hud__simple { grid-column: 1; grid-row: 1; justify-self: start; border: 0; background: none; color: var(--ivory-dim); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 0; }
.hud__hint {
  position: fixed; left: 50%; top: 128px; transform: translate(-50%, -10px); margin: 0; max-width: min(560px, calc(100% - 32px));
  padding: 10px 18px; border-radius: 999px; background: rgba(28,25,23,.82); border: 1px solid var(--gold-line);
  font-size: 14px; text-align: center; opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none;
}
.hud__hint.is-on { opacity: 1; transform: translate(-50%, 0); }
.recbar {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 18px; border-radius: 999px; background: rgba(28,25,23,.9); border: 1px solid var(--gold); backdrop-filter: blur(6px);
  font-size: 15px; white-space: nowrap; max-width: calc(100% - 24px);
}
.recbar[hidden] { display: none; }
.recbar__count { color: var(--gold); font-size: 13px; }
.recbar__name { overflow: hidden; text-overflow: ellipsis; }
.recbar__x { border: 0; background: none; color: var(--ivory-dim); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.is-inspecting .hud, .is-inspecting .recbar { visibility: hidden; }

/* Sheets: shopkeeper, product, basket */
.sheet {
  color: var(--brown); background: var(--ivory); border: 0; border-radius: var(--radius-md);
  padding: 30px 30px 26px; width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 40px); overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.sheet::backdrop { background: rgba(10,8,7,.55); backdrop-filter: blur(2px); }
.sheet h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 10px; }
.sheet .eyebrow { margin-bottom: 8px; color: #8a6c44; }
.sheet p { margin: 0 0 14px; }
.sheet__close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--brown); padding: 4px 8px; }
dialog.sheet { position: fixed; }
.sheet .btn-ghost { border-color: rgba(28,25,23,.25); color: var(--brown); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.chip-toggle {
  border: 1px solid rgba(28,25,23,.22); background: var(--white); color: var(--brown);
  padding: 9px 15px; border-radius: 999px; cursor: pointer; font-size: 15px;
}
.chip-toggle[aria-pressed="true"], .chip-toggle[aria-checked="true"] { background: var(--teal); border-color: var(--teal); color: var(--ivory); }
.keeper__menu summary { cursor: pointer; color: #6b5435; margin-bottom: 8px; }
.keeper__menu textarea { width: 100%; font: inherit; font-size: 15px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(28,25,23,.22); background: var(--white); resize: vertical; }
.keeper__nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.keeper__result { list-style: none; margin: 10px 0 16px; padding: 0; }
.keeper__result li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(28,25,23,.12); }
.keeper__result strong { display: block; font-weight: 500; }
.keeper__result span { font-size: 14px; color: rgba(28,25,23,.62); }
.keeper__qty { text-align: right; flex: none; }
.keeper__qty b { display: block; font-weight: 500; }

.stepper { display: inline-flex; align-items: center; border: 1px solid rgba(28,25,23,.22); border-radius: 999px; background: var(--white); }
.stepper button { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--brown); border-radius: 999px; }
.stepper button:hover { background: rgba(184,151,106,.18); }
.stepper input { width: 64px; border: 0; text-align: center; font: inherit; background: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Product in hand: a side panel in 3D, a dialog-like card in the simple view */
.inspect { position: fixed; z-index: 25; top: 76px; right: 20px; bottom: 20px; width: 400px; height: auto; max-height: none; }
.inspect[hidden] { display: none; }
.inspect .spec-table { margin: 12px 0 18px; }
.inspect__label { font-size: 14px; color: rgba(28,25,23,.62); margin: 0 0 8px !important; }
.inspect__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inspect__qty-note { font-size: 14px; color: rgba(28,25,23,.62); margin: 8px 0 16px !important; }
.inspect__market { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inspect__photo { background: var(--sand); border-radius: var(--radius-sm); overflow: hidden; margin: 6px 0 4px; }
.inspect__photo img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; }
.is-2d .inspect { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 40px); box-shadow: 0 0 0 100vmax rgba(10,8,7,.6), 0 30px 80px rgba(0,0,0,.45); }
@media (max-width: 860px) {
  .is-3d .inspect { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 56dvh; border-radius: var(--radius-md) var(--radius-md) 0 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

.basket__list { list-style: none; margin: 8px 0 14px; padding: 0; }
.basket__list li { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(28,25,23,.12); }
.basket__info strong { display: block; font-weight: 500; }
.basket__info span { font-size: 14px; color: rgba(28,25,23,.62); }
.basket__market { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.basket__terms { font-size: 13px; color: rgba(28,25,23,.62); }
.basket__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.toast {
  position: fixed; left: 50%; top: 78px; z-index: 60; transform: translate(-50%, -12px);
  padding: 11px 18px; border-radius: 999px; background: var(--teal); color: var(--ivory); font-size: 14px;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Simple (2D) shop */
.shop2d { position: relative; z-index: 2; padding: 110px 0 80px; }
.shop2d[hidden] { display: none; }
.shop2d__lead { color: var(--ivory-dim); max-width: 560px; }
.shop2d__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 40px; }
.aisle2d { margin-bottom: 48px; }
.aisle2d h2 { margin-bottom: 4px; }
.aisle2d__sub { color: var(--gold); margin: 0 0 18px; }
.aisle2d__shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; padding: 18px;
  border-radius: var(--radius-md); background: linear-gradient(180deg, #2E2925, #24201D); border-bottom: 6px solid var(--gold);
}
.card2d { display: grid; gap: 6px; text-align: left; padding: 12px 12px 16px; border-radius: var(--radius-sm); background: var(--ivory); color: var(--brown); border: 2px solid transparent; cursor: pointer; }
.card2d:hover { border-color: var(--gold); }
.card2d.is-rec { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(5,58,74,.35); }
.card2d__photo { display: block; background: var(--sand); border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.card2d__photo img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; }
.card2d strong { font-weight: 500; }
.card2d span { font-size: 14px; color: rgba(28,25,23,.62); }

@media (max-width: 860px) {
  .hud { grid-template-columns: 1fr auto; padding-inline: 12px; }
  .hud__jump { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .hud__jump button { padding: 9px 12px; }
  .hud__ask { grid-column: 2; grid-row: 1; }
  .hud__simple { grid-column: 1; grid-row: 1; }
  .shop-exit { display: none; }
  .shop-bar .brand img { width: 128px; height: auto; }
}
@media (max-width: 560px) {
  .entrance__doors { grid-template-columns: 1fr; }
  .basket-btn span { display: none; }
  .sheet { padding: 26px 20px 22px; }
  .recbar { font-size: 14px; gap: 6px; padding-left: 14px; }
  .recbar__count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .door, .door::after, .toast, .hud__hint { transition: none; }
  .loading__ring { animation: none; }
}
