/* Hux Shop (The Trading Post) in HuxOS: the v2 shop markup, restyled as an
   XP-era storefront. The studio, cart and size guide are XP dialogs. */

/* product previews */
.mock { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; }
.mock-photo { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.mock-print { position: absolute; z-index: 2; overflow: visible; pointer-events: none; }
.mock-print.ink-dark image, .mock-print.ink-dark text { mix-blend-mode: multiply; }
.mock-print text.hint { opacity: .28; }

/* shared bits the shop's markup uses */
.shop-app, .xpdlg { --ink-2: #444; --gold: #e8a213; font-size: 12px; }
.shop-app .btn, .xpdlg .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 24px; padding: 3px 12px;
  border: 1px solid #003c74; border-radius: 3px; background: linear-gradient(180deg, #fff, #ecebe6 86%, #d6d0c5); color: #000; text-decoration: none; white-space: nowrap;
}
.shop-app .btn:hover, .xpdlg .btn:hover { box-shadow: inset -1px 1px #fff0cf, inset 1px 2px #fdd889, inset -2px 2px #fbc761, inset 2px -2px #e5a01a; }
.shop-app .btn-primary, .xpdlg .btn-primary { border-color: #2d6e1e; background: linear-gradient(180deg, #e6ffd8, #b9e89d 50%, #8fd06a); font-weight: bold; }
.xpdlg .btn-primary:disabled, .shop-app .btn-primary:disabled { filter: grayscale(1); opacity: .65; }
.shop-app .btn-sm { min-height: 22px; padding: 2px 10px; }
.btn-block { width: 100%; min-height: 32px !important; font-size: 13px; }
.shop-app .btn svg, .xpdlg .btn svg { width: 16px; height: 16px; }
.shop-app .input, .xpdlg .input { width: 100%; border: 1px solid #7f9db9; padding: 4px 6px; min-height: 26px; background: #fff; user-select: text; -webkit-user-select: text; }
.shop-app .link, .xpdlg a { color: var(--link); }
.shop-app .muted, .xpdlg .muted { color: #666; }
.xpdlg .hint, .shop-app .hint { color: #555; font-size: 11px; }
.xpdlg .form-error { color: #c0261b; }
.xpdlg .form-error:empty { display: none; }

/* the window */
.shop-bar .shop-bar-n { min-width: 16px; padding: 0 4px; border-radius: 8px; background: #e2412a; color: #fff; font: bold 10px/15px var(--ui); text-align: center; }
.shop-app { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.shop-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 14px 18px; }
.test-banner { flex: none; padding: 6px 12px; text-align: center; background: #ffffe1; border-bottom: 1px solid #c9b46a; }
.test-banner code { background: #fff; padding: 0 4px; border: 1px solid #ddd; }
.notice { margin: 12px 0 0; padding: 8px 12px; border: 1px solid #c9b46a; background: #ffffe1; }

.shop-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -14px; padding: 16px 18px; background: linear-gradient(90deg, #1d3a1c, #3d7a2a 60%, #6aa83a); color: #fff; border-bottom: 3px solid #e8a213; }
.shop-hero-copy { display: grid; gap: 4px; max-width: 640px; }
.shop-hero .eyebrow { font: bold 11px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: #ffd36e; }
.shop-hero h1 { font: bold 26px/1.1 var(--ui-title); text-shadow: 1px 2px 3px rgba(0, 0, 0, .35); }
.shop-hero .lead { color: #eef7e6; max-width: 56ch; }
.shop-hero .yi { color: #e6d2ff; }
.shop-cart-btn { min-height: 30px !important; }
.cart-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #e2412a; color: #fff; font: bold 11px/18px var(--ui); text-align: center; }

.chips { display: flex; gap: 2px; padding: 12px 0 0; margin-bottom: -1px; position: relative; z-index: 1; }
.chips button { padding: 4px 10px; border: 1px solid #919b9c; border-bottom: 0; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #fff, #ececea); }
.chips button[aria-selected="true"] { border-top: 2px solid #f8b30f; background: #fff; font-weight: bold; padding-bottom: 5px; }
.product-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); padding: 12px; border: 1px solid #919b9c; background: #f7f7f2; }
.loading { color: #555; padding: 30px 6px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #c3c3b5; border-radius: 4px; box-shadow: 1px 1px 2px rgba(0, 0, 0, .08); }
.pcard:hover { border-color: #316ac5; box-shadow: 0 0 0 1px #316ac5; }
.pcard-art { position: relative; display: block; width: 100%; padding: 0; border: 0; background: radial-gradient(circle at 50% 45%, #f1f6ff, #fff 70%); }
.pcard-art .pc-back { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; }
.pcard-art .pc-front { display: block; transition: opacity .3s; }
@media (hover: hover) { .pcard-art.has-back:hover .pc-back { opacity: 1; } .pcard-art.has-back:hover .pc-front { opacity: 0; } }
.pcard-body { padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; border-top: 1px solid #eee; }
.pcard h2 { font: bold 14px var(--ui-title); color: #0a246a; }
.pcard .from { color: #555; }
.pcard .from strong { color: #000; }
.pcard .tag { color: #666; font-size: 11px; }
.pcard .dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.pcard .dots span { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0, 0, 0, .35); }
.pcard .dots small { color: #777; font-size: 10px; }
.pcard .btn { margin-top: auto; align-self: flex-start; }

.shop-info { display: grid; gap: 8px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.shop-info .card { padding: 10px 12px; border: 1px solid #d0d0bf; border-radius: 4px; background: #fbfbf6; display: grid; gap: 4px; align-content: start; }
.shop-info h2 { font: bold 13px var(--ui-title); color: #0046d5; }
.shop-info p { color: #333; line-height: 1.5; }
.shop-credit { margin-top: 14px; color: #777; text-align: center; font-size: 11px; }

.order-panel { margin-top: 12px; padding: 12px 14px; display: grid; gap: 6px; border: 1px solid #2d8a22; border-radius: 4px; background: #f1fbea; }
.order-panel h2 { font: bold 18px var(--ui-title); color: #1d5a14; }
.order-panel .status { justify-self: start; padding: 1px 8px; border-radius: 8px; background: #2d8a22; color: #fff; font-weight: bold; font-size: 11px; }
.order-panel ul { margin: 0; padding-left: 18px; }
.order-panel .track { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── XP dialogs (studio, cart, size guide) ──────────────────────── */
.xpdlg { transform: translateZ(0); padding: 0; margin: auto; border: 3px solid var(--frame); border-top: 0; border-radius: 8px 8px 0 0; background: var(--face); color: #000; box-shadow: 3px 4px 14px rgba(0, 0, 0, .45); overflow: hidden; }
.xpdlg::backdrop { background: rgba(0, 0, 0, .25); }
.xpdlg::before {
  content: attr(data-title); display: block; height: 30px; margin: 0 -3px; padding: 7px 40px 0 10px; border-radius: 7px 7px 0 0;
  background: var(--title); color: var(--title-ink); text-shadow: var(--title-shadow); font: bold 13px/16px var(--ui-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xpdlg[open] { display: flex; flex-direction: column; }
.x-btn { position: fixed; top: 4px; right: 5px; z-index: 6; width: 21px; height: 21px; padding: 0; border: 1px solid #fff; border-radius: 3px; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 90% 90%, #cc4600 0%, #dc6527 55%, #cd7546 70%, #ffccb2 90%, #fff 100%); }
.x-btn:hover { filter: brightness(1.12); }
.x-btn svg { width: 13px; height: 13px; stroke-width: 3; }
.link-btn { color: var(--link); font-size: 11px; text-decoration: underline; border: 0; background: none; padding: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #7f9db9; background: #fff; }
.stepper button { width: 24px; height: 24px; border: 0; background: linear-gradient(180deg, #fff, #e3e3db); font-size: 14px; padding: 0; }
.stepper button:hover { background: #fff0cf; }
.stepper input { width: 34px; height: 24px; text-align: center; border: 0; border-left: 1px solid #ccc; border-right: 1px solid #ccc; -moz-appearance: textfield; appearance: textfield; font-weight: bold; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.studio { width: min(1040px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 24px)); max-width: none; max-height: none; }
.studio-inner { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.05fr 1fr; overflow: hidden; }
.p-preview { position: relative; display: grid; align-content: center; background: radial-gradient(circle at 50% 42%, #fff, #e8eef8 70%); border-right: 1px solid #aca899; }
.p-stage-wrap { position: relative; width: 100%; max-width: 520px; margin-inline: auto; padding: 14px; }
.p-stage { perspective: 1000px; }
.p-stage.flip .mock { animation: flip-in .45s ease-out; }
@keyframes flip-in { from { transform: rotateY(-75deg) scale(.92); opacity: .3; } }
.view-tabs { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 4; display: inline-flex; gap: 2px; }
.view-tabs button { padding: 3px 12px; border: 1px solid #003c74; border-radius: 3px; background: linear-gradient(180deg, #fff, #ecebe6 86%, #d6d0c5); }
.view-tabs button[aria-selected="true"] { background: linear-gradient(180deg, #cdcac3, #e3e3db 8%, #e5e5de 94%); font-weight: bold; }
.p-note { text-align: center; color: #777; font-size: 10px; padding: 0 12px 8px; }
.p-options { overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 0; display: grid; gap: 14px; align-content: start; background: #fff; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.p-head h2 { font: bold 20px/1.15 var(--ui-title); color: #0a246a; }
.p-price { font: bold 18px var(--ui-title); color: #1d5a14; white-space: nowrap; }
.p-blurb { color: #333; line-height: 1.5; }
.p-feats { margin: -6px 0 0; padding-left: 18px; color: #444; font-size: 11px; display: grid; gap: 2px; }
.sg-link { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--link); text-decoration: underline; padding: 0; }
.sg-link svg { width: 16px; height: 16px; }
.opt { border: 1px solid #d0d0bf; border-radius: 4px; margin: 0; padding: 8px 10px 10px; display: grid; gap: 8px; min-width: 0; }
.opt-label { display: flex; align-items: baseline; gap: 6px; font-weight: bold; color: #0046d5; padding: 0 3px; }
.opt-label span, .opt-label > label + span { color: #555; font-weight: normal; }
.opt-badge { margin-left: auto; padding: 0 6px; border-radius: 8px; background: #fff3c4; color: #7a4310 !important; font-size: 11px; font-weight: bold !important; }
.designs, .styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.design-btn { display: grid; justify-items: center; gap: 3px; padding: 6px; border: 1px solid #c3c3b5; border-radius: 3px; background: #fff; font-size: 11px; }
.design-btn img { width: 100%; height: 46px; object-fit: contain; }
.designs .design-btn img { background: #3a3a3a; border-radius: 2px; padding: 2px; }
.design-btn small { color: #666; }
.design-btn:hover { border-color: #e5a01a; }
.design-btn[aria-pressed="true"] { border: 2px solid #316ac5; background: #eef4ff; padding: 5px; }
.design-btn .yi, .layout-btn .yi { font-size: .78em; }
.layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.layout-btn { display: grid; justify-items: center; align-content: start; gap: 3px; padding: 7px 4px; border: 1px solid #c3c3b5; border-radius: 3px; background: #fff; text-align: center; }
.layout-btn[aria-pressed="true"] { border: 2px solid #316ac5; background: #eef4ff; padding: 6px 3px; }
.layout-art { height: 40px; display: grid; place-items: center; background: #3a3a3a; border-radius: 2px; width: 100%; padding: 2px; }
.layout-art img { max-height: 34px; max-width: 70px; object-fit: contain; }
.layout-art.stack { grid-template-rows: 22px 12px; gap: 2px; }
.layout-art.stack img { max-height: 100%; }
.layout-label { font-weight: bold; font-size: 11px; }
.layout-btn small { color: #666; font-size: 10px; line-height: 1.25; }
.back-note { padding: 6px 8px; border: 1px solid #9fbbe0; background: #eef4ff; font-size: 11px; }
.check-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #c3c3b5; border-radius: 3px; background: #fff; }
.check-opt input, .c-tos input { width: 14px; height: 14px; accent-color: #21a121; flex: none; }
.check-opt img { height: 20px; width: auto; max-width: 80px; object-fit: contain; background: #3a3a3a; border-radius: 2px; padding: 2px; }
.name-row { position: relative; }
.name-row .input { padding-right: 56px; text-transform: uppercase; letter-spacing: .06em; font-weight: bold; }
.name-count { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: #888; font-size: 11px; }
.pos { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.pos-legend { font-size: 11px; color: #555; font-weight: bold; padding: 0; }
.pos-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.pos-options.three { grid-template-columns: repeat(3, 1fr); }
.pos-options.stack { grid-template-columns: 1fr; }
.pos-opt { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid #c3c3b5; border-radius: 3px; background: #fff; }
.pos-opt input { accent-color: #316ac5; }
.pos-opt small { margin-left: auto; color: #666; }
.pos-opt:has(input:checked) { border-color: #316ac5; background: #eef4ff; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 3px; border: 1px solid #555; box-shadow: inset 0 0 0 2px #fff; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid #316ac5; outline-offset: 2px; }
.swatch.more { background: #fff; color: #333; font-size: 11px; font-weight: bold; box-shadow: none; border-color: #c3c3b5; }
.sizes { display: flex; flex-wrap: wrap; gap: 5px; }
.size-btn { min-width: 46px; padding: 4px 8px; border: 1px solid #003c74; border-radius: 3px; background: linear-gradient(180deg, #fff, #ecebe6 86%, #d6d0c5); font-weight: bold; display: grid; justify-items: center; line-height: 1.15; }
.size-btn small { color: #666; font-weight: normal; font-size: 10px; }
.size-btn[aria-pressed="true"] { background: #316ac5; color: #fff; border-color: #0a246a; }
.size-btn[aria-pressed="true"] small { color: #dfe8f8; }
.fit-hint { color: #a35a00 !important; }
.p-buybar { position: sticky; bottom: 0; z-index: 3; display: flex; gap: 8px; align-items: center; margin: 0 -16px; padding: 10px 16px; background: var(--face); border-top: 1px solid #aca899; }
.p-buybar .btn-primary { flex: 1; min-height: 30px; font-size: 13px; }
.p-buybar .btn-primary.needs-size { filter: grayscale(.6); }

.sgdialog { width: min(760px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); }
.sg-inner { display: grid; grid-template-rows: auto 1fr; min-height: 0; max-height: calc(100dvh - 54px); background: #fff; }
.sg-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--face); border-bottom: 1px solid #aca899; }
.sg-head h2 { font: bold 14px var(--ui-title); margin-right: auto; color: #0a246a; }
.unit-toggle { display: inline-flex; }
.unit-toggle button { padding: 2px 10px; border: 1px solid #003c74; background: linear-gradient(180deg, #fff, #ecebe6 86%, #d6d0c5); }
.unit-toggle button:first-child { border-radius: 3px 0 0 3px; }
.unit-toggle button:last-child { border-radius: 0 3px 3px 0; border-left: 0; }
.unit-toggle button[aria-pressed="true"] { background: #316ac5; color: #fff; }
.sg-body { overflow: auto; padding: 12px 14px 18px; display: grid; gap: 18px; }
.sg-table h3 { font: bold 13px var(--ui-title); margin-bottom: 6px; color: #0046d5; }
.sg-scroll { overflow-x: auto; }
.sg-table table { border-collapse: collapse; width: 100%; font-size: 11px; }
.sg-table th, .sg-table td { padding: 4px 8px; border: 1px solid #d0d0bf; text-align: center; white-space: nowrap; }
.sg-table thead th { background: linear-gradient(180deg, #fff, #ebeadb); }
.sg-table th[scope="row"] { text-align: left; color: #333; background: #f7f7f2; }
.sg-fig { display: grid; gap: 10px; margin-top: 10px; grid-template-columns: minmax(0, 150px) 1fr; align-items: start; }
.sg-fig img { background: #fff; border: 1px solid #ddd; padding: 4px; }
.sg-fig ul { margin: 0; padding-left: 16px; color: #444; font-size: 11px; display: grid; gap: 3px; }
.sg-note { color: #555; font-size: 11px; margin-top: 6px; }
.sg-note.fit { color: #a35a00; font-weight: bold; }

.drawer { width: min(460px, calc(100vw - 20px)); height: min(680px, calc(100dvh - 20px)); max-height: none; margin-right: 14px; margin-bottom: 40px; }
.drawer-inner { flex: 1; min-height: 0; display: grid; grid-template-rows: auto 1fr auto; background: #fff; }
.c-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--face); border-bottom: 1px solid #aca899; }
.c-head h2 { font: bold 15px var(--ui-title); color: #0a246a; }
.c-lines { list-style: none; margin: 0; padding: 6px 12px; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.c-line { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e3e3db; }
.c-line .thumb { border: 1px solid #ddd; background: #fff; align-self: start; }
.c-line h3 { font: bold 12px/1.3 var(--ui); color: #0a246a; }
.c-line .meta { color: #555; font-size: 11px; }
.c-line .right { display: grid; justify-items: end; gap: 4px; align-content: start; }
.c-empty { display: grid; gap: 4px; place-content: center; text-align: center; padding: 30px 16px; color: #333; }
.c-foot { padding: 10px 12px 12px; border-top: 1px solid #aca899; display: grid; gap: 8px; background: var(--face); }
.c-country { display: grid; gap: 3px; }
.c-country select { border: 1px solid #7f9db9; padding: 3px; background: #fff; }
.c-sums { margin: 0; display: grid; gap: 2px; }
.c-sums div { display: flex; justify-content: space-between; color: #444; }
.c-sums dd { margin: 0; color: #000; }
.c-sums .c-total { font-weight: bold; font-size: 14px; padding-top: 4px; border-top: 1px solid #aca899; }
.c-tos { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid #c9b46a; background: #ffffe1; cursor: pointer; line-height: 1.45; }
.c-tos input { margin-top: 2px; }

html.pocket .shop-scroll { padding: 0 10px 16px; }
html.pocket .shop-hero { margin: 0 -10px; padding: 14px 12px; }
html.pocket .studio, html.pocket .drawer, html.pocket .sgdialog { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-width: 0; border-radius: 0; }
html.pocket .xpdlg::before { border-radius: 0; height: 38px; padding-top: 11px; font-size: 15px; }
html.pocket .x-btn { width: 30px; height: 30px; top: 4px; right: 6px; }
html.pocket .studio-inner { grid-template-columns: none; grid-template-rows: auto 1fr; }
html.pocket .p-preview { border-right: 0; border-bottom: 1px solid #aca899; }
html.pocket .p-stage-wrap { max-width: min(40dvh, 420px); padding: 6px; }
html.pocket .p-buybar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
html.pocket .swatch { width: 34px; height: 34px; }
html.pocket .size-btn { min-width: 52px; padding: 7px 10px; }

/* ── Hand-crafting screen ───────────────────────────────────────── */
.craft { width: min(440px, calc(100vw - 24px)); }
.craft, .craft * { -webkit-user-select: none; user-select: none; }
.craft button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.craft-inner { display: grid; gap: 10px; padding: 16px 18px 18px; text-align: center; }
.craft-inner h2 { margin: 0; font: bold 16px/1.3 var(--ui-title); color: #0a246a; }
.craft-inner p { margin: 0; }
.craft-art { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 12px 0; font-size: 30px; line-height: 1; }
.craft-path { position: relative; height: 26px; container-type: inline-size; border-bottom: 2px dotted #aca899; }
.craft-path i { position: absolute; left: 0; bottom: -6px; width: 10px; height: 10px; border-radius: 50%; background: #ffd36e; box-shadow: 0 0 9px 4px rgba(255, 190, 60, .85); }
.craft-line { min-height: 1.4em; color: #333; }
.craft-meter { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 8px; }
.craft-meter b { text-align: right; font: bold 15px var(--ui-title); color: #0a246a; font-variant-numeric: tabular-nums; }
.craft-quip { min-height: 1.4em; color: #c46a00; font-weight: bold; }
.craft-btns { display: flex; justify-content: center; gap: 8px; }
.craft-btns[hidden] { display: none; }
