/* The Add credits card (UV, 24 Nov; docs/design/shop.md, Stage 1; canvas artboard 2).
   One card over whatever page you are on: a sheet rising from the foot on a phone,
   centred and no wider than --cc-width above that. Solid (--bg-base), as the profile
   menu is on a phone, so the page under it never confuses a number. Built by
   scripts/credits-card.js; tokens --cc-* and --qr-* in variables.css. */

.cc {
	width: 100%;
	max-width: var(--cc-width);
	max-height: calc(100dvh - var(--space-5));
	margin: auto auto 0;
	padding: var(--space-3) var(--space-5) var(--space-5);
	padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
	border: 0;
	border-radius: var(--radius-lg) var(--radius-lg) 0 0;
	background: var(--bg-base);
	color: var(--text-primary);
	box-shadow: var(--shadow-panel);
	overflow-y: auto;
	overscroll-behavior: contain;
}
.cc::backdrop { background: var(--scrim); }
@media (min-width: 40rem) {
	.cc { margin: auto; border-radius: var(--radius-lg); padding-bottom: var(--space-5); }
}

/* ─── The head: back, the title, close ───
   The space under the title is the banner's under the event name (UV, 4 Dec: "Fix
   spacing below card headings (custom font). Should be same as margin below event
   name in banner"; sandbox.css, .mg-head): the title trimmed to its capitals and
   baseline, and --heading-gap under it. When the card starts with words (a label or
   a paragraph, the first shown in the first block, up to three deep), they are trimmed to
   their capitals too, so the gap is all the space there is; a field that starts
   with its box (a drop-down, a text input) keeps its own. The back button takes
   no more height than the capitals (its tap area overhangs, as it did the card's
   padding). */
.cc-head {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--heading-gap);
}
.cc-head + :is(p, label),
.cc-head + * > :nth-child(1 of :not([hidden])):is(p, label),
.cc-head + * > :nth-child(1 of :not([hidden])) > :nth-child(1 of :not([hidden])):is(p, label),
.cc-head + * > :nth-child(1 of :not([hidden])) > :nth-child(1 of :not([hidden])) > :nth-child(1 of :not([hidden])):is(p, label) { text-box: trim-start cap alphabetic; }
.cc-head h2 {
	flex: 1;
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--card-title);
	font-weight: 400;
	line-height: 1.32;
	text-box: trim-both cap alphabetic;
}
.cc-head h2:focus { outline: none; }   /* focused only so opening doesn't ring Close */
/* Back: the frame as tall as the title's capitals (UV, 4 Dec: "make the frame
   around the close button on the cards smaller (same size as the card heading
   text)"; --card-title-caps), drawn by ::before. The button stays a field's size,
   so it is as easy to tap at the bar (ui.md: tap targets matter more than
   density), and hangs into the card's padding so the frame's edge meets the
   title's line. Close is the bar at the top now (.cc-grab, below). */
.cc-icon {
	--cc-icon-frame: var(--card-title-caps);
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: var(--nm-field);
	height: var(--nm-field);
	padding: 0;
	border: 0;
	border-radius: var(--radius-round);
	background: transparent;
	color: var(--text-primary);
	font-size: 0.75rem;   /* a ✕ written as a character, the frame's size less its ring */
	cursor: pointer;
}
.cc-icon::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--cc-icon-frame);
	height: var(--cc-icon-frame);
	border-radius: var(--radius-round);
	transform: translate(-50%, -50%);
	box-shadow: var(--nm-sunken-tiny);   /* pressable, so inset (UV, 4 Dec: "let all clickable elements have inner shadow rather than outer"); tiny, as the frame is */
	pointer-events: none;
}
.cc-icon:active::before { box-shadow: var(--nm-pressed-tiny); }   /* a press, deeper (UV, 4 Dec: "Deeper inset while pressed") */
.cc-icon svg { width: 0.75rem; height: 0.75rem; }
.cc-head > .cc-icon:first-child { margin-left: calc((var(--cc-icon-frame) - var(--nm-field)) / 2); }
.cc-head > .cc-icon { margin-block: calc((var(--cc-icon-frame) - var(--nm-field)) / 2); }

/* Close: a bar across the top of the card (UV, 4 Dec: "Replace the cross for
   closing cards with a horizontal bar at the top of the card"), put there by
   TDC.cardOpen: tap it, or pull the card down by it and let go. Thin, and its
   handle small (UV, 4 Dec: "make the bar at top of cards thinner and handle area
   smaller as well"): the button is twice the bar's width and a little taller
   than it, in the card's top padding; the bar is drawn by ::before, grey as a
   field's line. Each card's own ✕ (a .cc-icon labelled Close) stays in its head,
   unseen: the bar presses it, so a card that does more on closing still does. */
.cc-grab {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 5rem;
	height: var(--space-4);
	margin: calc(-1 * var(--space-2)) auto 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	cursor: grab;
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
}
.cc-grab::before {
	content: "";
	width: 2.5rem;
	height: 3px;
	border-radius: var(--radius-pill);
	background: var(--text-muted);
}
.cc-grab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.cc-head > .cc-icon[aria-label="Close"] { display: none; }

.cc-venue { margin-bottom: var(--space-4); }

/* ─── 1. The amount ─── */
.cc-amount {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: var(--space-2) var(--space-4) var(--space-3);
	border-radius: var(--radius-lg);
	box-shadow: var(--nm-sunken);
}
.cc .cc-amount input {
	width: 100%;
	min-height: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
	color: var(--text-primary);
	font-family: var(--font-display);
	font-size: var(--cc-amount-size);
	line-height: 1.32;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}
.cc .cc-amount input::-webkit-outer-spin-button,
.cc .cc-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cc-amount-unit { color: var(--text-muted); font-size: 0.85rem; }

/* The slider: a sunken groove, a raised knob ringed in green. Dragged sideways only. */
.cc-slider { position: relative; margin-top: var(--space-4); }
.cc-range {
	display: block;
	width: 100%;
	height: var(--nm-field);
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	touch-action: none;
	cursor: pointer;
}
.cc-range::-webkit-slider-runnable-track {
	height: var(--cc-track);
	border-radius: var(--radius-pill);
	box-shadow: var(--nm-sunken-small);
}
.cc-range::-moz-range-track {
	height: var(--cc-track);
	border-radius: var(--radius-pill);
	box-shadow: var(--nm-sunken-small);
}
.cc-range::-webkit-slider-thumb {
	width: var(--cc-thumb);
	height: var(--cc-thumb);
	margin-top: calc((var(--cc-track) - var(--cc-thumb)) / 2);
	border: 2px solid var(--color-primary);
	border-radius: var(--radius-round);
	background: var(--bg-base);
	box-shadow: var(--nm-raised-small);
	-webkit-appearance: none;
}
.cc-range::-moz-range-thumb {
	width: var(--cc-thumb);
	height: var(--cc-thumb);
	border: 2px solid var(--color-primary);
	border-radius: var(--radius-round);
	background: var(--bg-base);
	box-shadow: var(--nm-raised-small);
}
.cc-range:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-pill); }

/* Discount ticks under the groove, lit once passed. None while no discount is set. */
.cc-ticks { position: relative; height: 2.5rem; margin: 0 calc(var(--cc-thumb) / 2); }
.cc-ticks:empty { display: none; }
.cc-tick {
	position: absolute;
	top: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: translateX(-50%);
	color: var(--text-muted);
	font-size: 0.75rem;
	line-height: 1.2;
	white-space: nowrap;
}
.cc-tick::before { content: ''; width: 2px; height: var(--space-2); margin-bottom: 2px; border-radius: 1px; background: currentColor; }
.cc-tick b { font-weight: 700; }
.cc-tick.is-passed { color: var(--color-primary); }

.cc-sum {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
	margin: var(--space-4) 0;
}
.cc-save { color: var(--text-muted); font-size: 0.85rem; }
.cc-price { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.32; white-space: nowrap; }

.cc .btn { width: 100%; margin: 0; }

/* The ways to pay, small under Checkout: only At the club is lit. */
.cc-ways { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.cc-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	padding: var(--space-1) var(--space-3);
	border-radius: var(--radius-pill);
	box-shadow: var(--nm-sunken-small);
	color: var(--text-muted);
	font-size: 0.75rem;
}
.cc-chip svg { width: 0.9rem; height: 0.9rem; }
.cc-chip.is-on { color: var(--text-primary); }
.cc-chip.is-on svg { color: var(--color-primary); }

/* ─── 2. Checkout ─── */
.cc-lines { padding: var(--space-2) var(--space-4); border-radius: var(--radius-lg); box-shadow: var(--nm-sunken); }
.cc-line { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; }
.cc-line.is-off { color: var(--color-primary); }
.cc-line.is-total { margin-top: var(--space-1); padding-top: var(--space-2); border-top: 1px solid var(--border-color); font-weight: 700; }

.cc-who { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 var(--space-2); }
.cc-who-pic {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: var(--radius-round);
	overflow: hidden;
	box-shadow: var(--nm-sunken-small);
	color: var(--text-muted);
	font-size: 0.85rem;
	font-weight: 700;
}
.cc-who-pic img { width: 100%; height: 100%; object-fit: cover; }
.cc-who-name { font-weight: 600; }
.cc-who-text { display: flex; flex-direction: column; min-width: 0; }
.cc-who-mail { color: var(--text-muted); font-size: 0.85rem; overflow-wrap: anywhere; }

.cc-label { margin: var(--space-4) 0 var(--space-2); color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }
.cc-way {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	min-height: var(--nm-field);
	margin-bottom: var(--space-2);
	padding: 0 var(--nm-pad);
	border-radius: var(--radius-pill);
}
.cc-way svg { width: 1.25rem; height: 1.25rem; flex: none; }
.cc-way span { flex: 1; }
.cc-way.is-off { box-shadow: var(--nm-sunken-small); color: var(--text-muted); }
.cc-way.is-off small { font-size: 0.75rem; }
.cc-way.is-on { box-shadow: var(--nm-sunken-small), inset 0 0 0 2px var(--color-primary); }
.cc-way.is-on svg { color: var(--color-primary); }
.cc-way:not(.is-off):active { box-shadow: var(--nm-pressed-small); }
.cc-way.is-on:active { box-shadow: var(--nm-pressed-small), inset 0 0 0 2px var(--color-primary); }
.cc-pay-go { margin-top: var(--space-3); }

/* ─── 3. The code ─── */
.cc-code-step { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cc-code-step > p { margin: 0 0 var(--space-4); color: var(--text-muted); }
.cc-qr {
	width: var(--cc-qr-size);
	height: var(--cc-qr-size);
	/* No padding: the code's 4-dot quiet zone is part of the drawing (qrSvg). */
	padding: 0;
	border-radius: var(--radius-md);
	background: var(--qr-paper);
	box-shadow: var(--nm-raised-small);
}
.cc-qr svg { display: block; width: 100%; height: 100%; }
/* The site's QR (TDCCredits.qrSvg; the cards and the home page): the code's SVG
   filling the box, the theme's icon laid over its middle as an <img> (an SVG
   <image> drew a pale box round the diver on iPhones). */
.tdc-qr { position: relative; width: 100%; height: 100%; }
.tdc-qr > svg { display: block; width: 100%; height: 100%; }
.tdc-qr-logo { position: absolute; display: block; object-fit: contain; pointer-events: none; }
.cc-code {
	margin-top: var(--space-4);
	font-family: var(--font-mono);
	font-size: var(--cc-code-size);
	font-weight: 700;
	letter-spacing: 0.25em;
	padding-left: 0.25em; /* the letter spacing's last gap, so the code sits centred */
}
.cc-state {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin-top: var(--space-3);
	padding: var(--space-1) var(--space-4);
	border-radius: var(--radius-pill);
	box-shadow: var(--nm-sunken-small);
	font-size: 0.85rem;
}
.cc-state::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: var(--radius-round); background: var(--cc-state, var(--text-muted)); }
.cc-state.is-waiting { --cc-state: var(--color-warning); }
.cc-state.is-paid { --cc-state: var(--color-primary); color: var(--color-primary); }
.cc-state.is-over { --cc-state: var(--text-muted); color: var(--text-muted); }
.cc-until { margin: var(--space-2) 0 var(--space-4); color: var(--text-muted); font-size: 0.85rem; }
.cc-code-step .btn + .btn { margin-top: var(--space-3); }

.cc .status:empty { display: none; }
.cc .status { margin-top: var(--space-3); }
