/* Origin Store page (store.html). Builds on site.css: same tokens, buttons,
   header and footer; only store-specific pieces live here. */

/* site.css sets img { display: block }, which would beat the hidden attribute. */
.page-store [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-store .backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 50% at 20% 30%, rgba(95, 208, 155, .08), rgba(95, 208, 155, 0) 70%); }

.store { max-width: 1320px; margin: 0 auto; padding: 108px var(--gutter) 96px; }

/* ---------- return-from-checkout notice ---------- */
.notice { margin: 0 0 28px; padding: 16px 20px; background: var(--acc-soft); border: 1px solid var(--acc-border); border-radius: 3px; color: var(--text); }
.notice b { color: var(--acc-h); }

/* ---------- intro ---------- */
.store__intro { max-width: 760px; margin-bottom: 40px; }
.store__intro h1 { font-size: clamp(36px, 5.4vw, 68px); line-height: 1.02; letter-spacing: -.02em; margin-bottom: 18px; }
.store__intro .lede { margin: 0; }

/* ---------- layout ---------- */
.store__layout { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }

/* ---------- fitting room ---------- */
.fit { position: sticky; top: 84px; background: var(--glass); border: 1px solid var(--soft); border-radius: 3px; box-shadow: 0 4px 0 rgba(0, 0, 0, .48); overflow: hidden; scroll-margin-top: 84px; }
.fit__stage { position: relative; height: clamp(260px, 38vh, 400px); background: radial-gradient(ellipse 60% 55% at 50% 58%, rgba(95, 208, 155, .16), rgba(95, 208, 155, 0) 70%), linear-gradient(#1b2320, #121614); border-bottom: 1px solid var(--soft); }
.fit__stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.fit__stage canvas:active { cursor: grabbing; }
.fit__flat { display: none; position: absolute; inset: 0; place-items: center; }
.fit__flat img { height: 70%; width: auto; image-rendering: pixelated; }
.fit__flat .item__mark { width: 40%; height: 40%; }
body.no-webgl .fit__stage canvas { display: none; }
body.no-webgl .fit__flat { display: grid; }
body.no-webgl .fit__hint { display: none; }
.fit__label, .fit__hint { position: absolute; margin: 0; font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; pointer-events: none; }
.fit__label { left: 16px; top: 16px; color: var(--acc-h); }
.fit__hint { right: 16px; bottom: 14px; color: var(--muted); }

.fit__panel { padding: 20px; }
.field__label { display: block; margin-bottom: 8px; font: 600 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.name { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; background: var(--card); border: 1px solid var(--soft); border-radius: 2px; transition: border-color .12s; }
.name:focus-within { border-color: var(--stroke); }
.name[data-state="ok"] { border-color: var(--acc-border); }
.name[data-state="bad"], .name[data-state="missing"] { border-color: rgba(224, 107, 91, .7); }
.name__head { width: 30px; height: 30px; image-rendering: pixelated; border-radius: 1px; flex: none; }
.name input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--text); font: 600 16px/1 var(--mono); outline: none; }
.name input::placeholder { color: var(--muted); }
.name__state { flex: none; font: 700 15px/1 var(--mono); }
.name[data-state="ok"] .name__state::before { content: "\2713"; color: var(--acc); }
.name[data-state="checking"] .name__state::before { content: "\2026"; color: var(--muted); }
.name[data-state="bad"] .name__state::before, .name[data-state="missing"] .name__state::before { content: "!"; color: var(--danger); }
.name__note { min-height: 2.8em; margin: 8px 0 18px; color: var(--dim); font-size: 13px; line-height: 1.4; }
.name[data-state="bad"] + .name__note, .name[data-state="missing"] + .name__note { color: #f0a195; }

.bag__title { margin: 0 0 10px; font: 600 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.bag { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bag li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 9px 6px 9px 12px; background: var(--card); border: 1px solid var(--soft); border-radius: 1px; font: 600 13px/1.2 var(--mono); }
.bag li b { color: var(--dim); font-weight: 600; }
.bag button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 1px; background: none; color: var(--muted); font: 600 18px/1 var(--sans); cursor: pointer; }
.bag button:hover { background: var(--card-alt); color: var(--text); }
.bag .bag__empty { display: block; padding: 14px 12px; background: none; border-style: dashed; color: var(--muted); font: 400 13px/1.4 var(--sans); }
.bag__total { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 14px; font: 600 13px/1 var(--mono); color: var(--dim); }
.bag__total b { font-size: 22px; color: var(--text); }
.bag__go { width: 100%; }
.bag__go:disabled { opacity: .55; cursor: not-allowed; }
.bag__go:disabled:active { transform: none; }
.bag__note { min-height: 1.4em; margin: 12px 0 0; color: var(--dim); font-size: 13px; line-height: 1.4; text-align: center; }
.bag__note.is-error { color: #f0a195; }
.pay { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.pay li { padding: 5px 8px; border: 1px solid var(--soft); border-radius: 1px; font: 600 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---------- shop ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs button { height: 38px; padding: 0 14px; border: 1px solid var(--soft); border-radius: 1px; background: rgba(29, 36, 32, .7); color: var(--dim); font: 600 13px/1 var(--mono); cursor: pointer; transition: background-color .12s, color .12s, border-color .12s; }
.tabs button:hover { color: var(--text); background: var(--card-alt); }
.tabs button[aria-pressed="true"] { background: var(--acc-soft); border-color: var(--acc-border); color: var(--acc-h); }

.shop__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.item { display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--soft); border-radius: 3px; box-shadow: 0 4px 0 rgba(0, 0, 0, .48); overflow: hidden; transition: border-color .12s, translate .12s var(--ease); }
.item:hover { border-color: var(--stroke); translate: 0 -2px; }
.item.is-trying { border-color: var(--acc-border); }
.item__try { position: relative; display: block; width: 100%; aspect-ratio: 5 / 4; padding: 0; border: 0; border-bottom: 1px solid var(--soft); background: radial-gradient(ellipse 60% 60% at 50% 60%, rgba(95, 208, 155, .12), rgba(95, 208, 155, 0) 70%), linear-gradient(#1d2420, #141917); color: inherit; cursor: pointer; overflow: hidden; }
.item__art { position: absolute; inset: 0; display: grid; place-items: center; }
.item__art img { width: 100%; height: 100%; object-fit: cover; }
.item__art .item__flat { width: auto; object-fit: contain; image-rendering: pixelated; }
.item__flat--cape { height: 74%; }
.item__flat--wings { height: 60%; }
.item__mark { width: 42%; height: 42%; color: var(--acc-h); stroke-width: 9; filter: drop-shadow(0 0 8px rgba(75, 200, 174, .45)); }
.item__kind, .item__tryon { position: absolute; top: 10px; padding: 5px 7px 4px; border-radius: 1px; font: 600 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.item__kind { left: 10px; background: rgba(14, 17, 16, .78); color: var(--dim); }
.item__anim { position: absolute; left: 10px; bottom: 10px; padding: 5px 7px 4px; border-radius: 1px; background: var(--acc-soft); border: 1px solid var(--acc-border); color: var(--acc-h); font: 600 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.item__anim::before { content: "\2726  "; }
.item__tryon { right: 10px; background: rgba(14, 17, 16, .78); color: var(--text); opacity: 0; transition: opacity .12s; }
.item__try:hover .item__tryon, .item__try:focus-visible .item__tryon, .item.is-trying .item__tryon { opacity: 1; }
.item.is-trying .item__tryon { background: var(--acc); color: var(--on-acc); }
.item__meta { padding: 14px 16px 0; flex: 1; }
.item__meta h3 { font-size: 15px; margin-bottom: 6px; }
.item__meta p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.45; }
.item__buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 16px; }
.item__buy b { font: 700 17px/1 var(--mono); }
.item__buy .btn[disabled] { cursor: default; }

.fine { display: grid; gap: 10px; margin-top: 28px; padding: 20px; background: rgba(14, 17, 16, .6); border: 1px solid var(--soft); border-radius: 3px; }
.fine p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.fine b { color: var(--text); font-weight: 600; }

/* ---------- header bag button ---------- */
.top__bag { margin-left: 8px; }
.top__count:empty { display: none; }
.top__count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; background: var(--acc); color: var(--on-acc); border-radius: 1px; font-size: 11px; }

/* ---------- phones ---------- */
.bagbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(14, 17, 16, .94); backdrop-filter: blur(14px); box-shadow: inset 0 1px 0 var(--soft); font: 600 13px/1 var(--mono); }
@media (max-width: 900px) {
  .store { padding-top: 92px; }
  /* Phones: preview, then the items, then name + bag (the bar jumps there). */
  .store__layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .fit { display: contents; }
  .fit__stage, .fit__panel { background-color: var(--glass); border: 1px solid var(--soft); border-radius: 3px; box-shadow: 0 4px 0 rgba(0, 0, 0, .48); }
  .fit__stage { order: 1; height: 320px; overflow: hidden; scroll-margin-top: 80px; }
  .shop { order: 2; }
  .fit__panel { order: 3; scroll-margin-top: 80px; }
  .bagbar:not([hidden]) { display: flex; }
  .page-store .foot { padding-bottom: 140px; }
  .shop__grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .item__meta { padding: 12px 12px 0; }
  .item__meta p { display: none; }
  .item__buy { flex-direction: column; align-items: stretch; padding: 10px 12px 12px; }
  .item__buy .btn { width: 100%; }
}
