/* The shop (/shop/; UV, 24 Nov; docs/design/shop.md, Stage 2; scripts/shop.js).
   Restyled 25 Nov (UV): the categories as raised cards; the product sheet (.cc) with the
   category's rows in one sunken panel with hairlines (docs/ui.md, "Long lists"), then a
   product's card; the cart bar following at the foot; the cart over the page in the
   Add credits card's look (credits-card.css's .cc). The foot (policies, company block) keeps
   league.css's policy look (.lr-*). Tokens --shop-* in variables.css. */

/* Under way, so yellow (docs/ui.md, "State colours"): online payment not open yet. */
.tdc-card .shop-pay-note {
	margin: 0 0 var(--space-5);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-lg);
	box-shadow: var(--nm-sunken-small);
	line-height: 1.5;
}
.shop-pay-note strong { color: var(--color-warning); }

/* ─── The category cards (UV, 25 Nov): raised, the picture on top, the name under it.
   Two across on a phone, three from 40rem; an odd count makes the first one full width,
   the leading card. ─── */
.shop-cats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-4);
}
.shop-cats:empty { display: none; }
@media (min-width: 40rem) {
	.shop-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tdc-card button.shop-cat {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-3);
	width: 100%;
	min-height: 0;
	margin: 0;
	padding: var(--space-3);
	border: 0;
	border-radius: var(--radius-lg);
	background: var(--bg-base);
	color: var(--text-primary);
	font: inherit;
	text-align: left;
	box-shadow: var(--nm-sunken);   /* pressable, so inset (UV, 4 Dec: "let all clickable elements have inner shadow rather than outer") */
	cursor: pointer;
}
.tdc-card button.shop-cat:active { box-shadow: var(--nm-pressed); }   /* a press, deeper (UV, 4 Dec: "Deeper inset while pressed") */
@media (max-width: 39.99rem) {
	.tdc-card button.shop-cat:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
	.shop-cat:first-child:nth-last-child(odd) .shop-cat-pic { aspect-ratio: var(--shop-lead-ratio); }
}
.shop-pic.shop-cat-pic { width: 100%; height: auto; aspect-ratio: 1; }
.shop-pic.shop-cat-pic .shop-pic-none { font-size: 2.5rem; }
.shop-cat-words { display: flex; flex-direction: column; padding: 0 var(--space-1) var(--space-1); }
.shop-cat-name { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.32; overflow-wrap: anywhere; }
.shop-cat-sub { color: var(--text-muted); font-size: 0.8rem; }

/* How many are in the cart: a solid green pill, on a card's corner or at a row's end. */
.shop-badge {
	flex: none;
	min-width: var(--shop-badge);
	height: var(--shop-badge);
	padding: 0 var(--space-2);
	border-radius: var(--radius-pill);
	background: var(--nm-light-colour);
	color: var(--color-on-primary);
	font-size: 0.8rem;
	font-weight: 700;
	line-height: var(--shop-badge);
	text-align: center;
}
.shop-cat .shop-badge { position: absolute; top: var(--space-4); right: var(--space-4); }

/* ─── The product sheet: the category's products as rows ─── */
.shop-list {
	list-style: none;
	margin: 0;
	padding: 0 var(--space-4);
	border-radius: var(--radius-lg);
	box-shadow: var(--nm-sunken);
}
.shop-list li + li { border-top: 1px solid var(--border-color); }
.shop-item {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	width: 100%;
	padding: var(--space-3) 0;
	border: 0;
	background: transparent;
	color: var(--text-primary);
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.shop-item .shop-words { display: flex; flex-direction: column; }
.shop-chev { flex: none; color: var(--text-muted); font-size: 1.5rem; line-height: 1; }

/* ─── A product's card, in the same sheet ─── */
.shop-pic.shop-hero { width: 100%; height: auto; aspect-ratio: var(--shop-hero-ratio); box-shadow: var(--nm-sunken); }
.shop-pic.shop-hero .shop-pic-none { font-size: 3rem; }
/* A product's 3D model in the hero's place (UV, 25 Nov; scripts/shop.js, modelHero). */
/* It floats above the card and casts its shadow down onto it, away from the site's light
   (page-light.js sets the offset), further out and softer than a card's so it reads as
   floating (UV, 25 Nov). */
.shop-model model-viewer {
	width: 100%;
	height: 100%;
	background: transparent;
	--poster-color: transparent;
	filter: drop-shadow(calc(var(--page-shadow-x, 0px) * var(--shop-model-float)) calc(var(--page-shadow-y, var(--page-inset-offset)) * var(--shop-model-float)) var(--shop-model-shadow-blur) rgba(0, 0, 0, var(--shop-model-shadow-alpha)));
}
.shop-prod-words { margin: var(--space-4) var(--space-1) var(--space-4); }
.shop-prod-name { margin: 0; font-family: var(--font-display); font-size: 1.3rem; font-weight: 400; line-height: 1.32; }
.shop-prod-price { color: var(--color-primary); font-weight: 600; }
.shop-prod-qty { display: flex; align-items: center; gap: var(--space-3); margin: 0 var(--space-1) var(--space-4); }
.shop-prod-sum { margin-left: auto; color: var(--text-muted); }
.shop-step:disabled { opacity: 0.4; cursor: default; }
.shop-pic {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: var(--shop-pic);
	height: var(--shop-pic);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--nm-sunken-small);
}
.shop-pic img { width: 100%; height: 100%; object-fit: cover; }
/* A picture lies under its frame's shadow as every picture on the site does (UV, 25 Nov):
   .shop-pic is in design.css's "Pictures set into the page" lists, .shop-hero with the deeper
   ones. A 3D model needs nothing: the viewer is see-through, so the box's own shadow shows. */
.shop-pic-none { color: var(--text-muted); font-family: var(--font-display); font-size: 1.5rem; line-height: 1.32; }
.shop-words { flex: 1; min-width: 0; }
.shop-name { font-weight: 600; overflow-wrap: anywhere; }
.shop-price { color: var(--text-muted); font-size: 0.85rem; }
.shop-collect { color: var(--text-muted); font-size: 0.75rem; }

.tdc-card .shop-empty { margin: var(--space-4) 0; text-align: center; }
.tdc-card .shop-credits-line { margin: var(--space-5) 0 0; font-size: 0.85rem; line-height: 1.5; }
.shop-foot { margin-top: var(--space-5); }
.shop-policies {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
	column-gap: var(--space-4);
}
.shop-policies li { padding: var(--space-3) 0; border-top: 1px solid var(--border-color); line-height: 1.4; }

/* Room at the foot so the cart bar never covers the last of the page. */
body:has(.shop-cartbar:not([hidden])) main { padding-bottom: calc(var(--shop-bar) + var(--space-6)); }

/* ─── The cart bar: follows at the foot ─── */
.shop-cartbar {
	position: fixed;
	left: 50%;
	bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
	z-index: 90;
	display: flex;
	align-items: center;
	gap: var(--space-2);
	width: calc(100% - 2 * var(--space-4));
	max-width: var(--cc-width);
	min-height: var(--shop-bar);
	padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
	border: 0;
	border-radius: var(--radius-pill);
	background: var(--bg-base);
	color: var(--text-primary);
	font: inherit;
	text-align: left;
	box-shadow: var(--shadow-panel);
	transform: translateX(-50%);
	cursor: pointer;
}
.shop-cartbar[hidden] { display: none; }
.shop-cartbar-count { font-weight: 700; }
.shop-cartbar-total { color: var(--text-muted); }
.shop-cartbar-go {
	margin-left: auto;
	padding: var(--space-3) var(--space-5);
	border-radius: var(--radius-pill);
	background: var(--nm-light-colour);
	color: var(--color-on-primary);
	font-weight: 700;
}

/* ─── The cart ─── */
.shop-cart-lines {
	list-style: none;
	margin: 0 0 var(--space-4);
	padding: 0 var(--space-4);
	border-radius: var(--radius-lg);
	box-shadow: var(--nm-sunken);
}
.shop-cart-line,
.shop-cart-empty { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) 0; }
.shop-cart-line + .shop-cart-line { border-top: 1px solid var(--border-color); }
.shop-cart-line.is-off .shop-name { color: var(--text-muted); text-decoration: line-through; }
.shop-cart-line.is-off .shop-price { color: var(--color-warning); }
.shop-step {
	flex: none;
	min-width: var(--shop-add);
	height: var(--shop-add);
	padding: 0 var(--space-2);
	border: 0;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--text-primary);
	font: inherit;
	font-size: 1.1rem;
	box-shadow: var(--nm-sunken-small);   /* pressable, so inset (UV, 4 Dec: "let all clickable elements have inner shadow rather than outer") */
	cursor: pointer;
}
.shop-step:active { box-shadow: var(--nm-pressed-small); }
.shop-step.is-plus { color: var(--color-primary); }
.shop-cart-line.is-off .shop-step { font-size: 0.85rem; }
.shop-step-n { min-width: 1.5rem; text-align: center; font-weight: 700; }
.shop-cart-total {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-2);
	margin: 0 var(--space-1) var(--space-4);
	color: var(--text-muted);
}
.shop-cart-sum { color: var(--text-primary); font-family: var(--font-display); font-size: 1.15rem; line-height: 1.32; text-align: right; }

/* ─── Checkout (Stage 3; canvas artboard 3): in the cart, under its lines ─── */
.shop-checkout[hidden] { display: none; }
/* The Add credits card's ways to pay (.cc-way), as buttons: the chosen one ringed in green. */
.cc-way.shop-way {
	width: 100%;
	border: 0;
	background: transparent;
	color: var(--text-primary);
	font: inherit;
	text-align: left;
	box-shadow: var(--nm-sunken-small);
	cursor: pointer;
}
.cc-way.shop-way small { color: var(--text-muted); font-size: 0.85rem; }
.cc-way.shop-way.is-on { box-shadow: var(--nm-sunken-small), inset 0 0 0 2px var(--color-primary); }
.cc-way.shop-way:active { box-shadow: var(--nm-pressed-small); }
.cc-way.shop-way.is-on:active { box-shadow: var(--nm-pressed-small), inset 0 0 0 2px var(--color-primary); }
.shop-checkout .shop-pay-said { margin: var(--space-1) var(--space-1) var(--space-3); color: var(--text-muted); font-size: 0.85rem; }
.shop-checkout .shop-pay-said:empty { display: none; }
/* Under way, so yellow (docs/ui.md, "State colours"): not enough credits yet. */
.shop-checkout .shop-pay-said.is-short { color: var(--color-warning); }
.shop-checkout .shop-add-credits { margin-bottom: var(--space-2); }
.shop-checkout .shop-add-credits[hidden] { display: none; }
.shop-collect-box {
	margin-bottom: var(--space-4);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-lg);
	box-shadow: var(--nm-sunken-small);
}
