/* AbbyFlash Store: the store's own styles. They load after the base look, /assets/css/style.css (the same file as
   abbyflash-account's), whose classes are used as they are: the page shell (.wrap, .skip, .visually-hidden), the
   header and footer, buttons (.btn), windows (.window, .window__bar, .window__close, .window__body), tags (.chip,
   .badge), dropdowns (.select), the item cards and pager (.card, .library__grid, .pager) and the 404 page
   (.not-found).
   The parts both sites have (panels, notices, fields, windows' contents) are the same rules as abbyflash-account's
   public/assets/site.css, so the two look alike: a change to one of those belongs in both. No inline styles. */

/* ------------------------------------------------------------------ tokens the base look doesn't have */
:root {
  --panel: 720px; /* a page that is one column of panels */
}

/* ------------------------------------------------------------------ text */
body { overflow-wrap: break-word; }
h1 { margin: 0 0 14px; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 12px; }
strong { font-weight: 650; }
.muted { color: var(--muted); font-size: .94rem; }

/* ------------------------------------------------------------------ page width: one column, or the whole width on an
   app's page (shop.js swaps main's wrap--panel for wrap--wide) */
main { padding-block: clamp(24px, 5vw, 48px) 48px; }
.wrap--panel { --wrap: var(--panel); }

/* ------------------------------------------------------------------ the start page's views (shop.js shows one): with
   JavaScript (theme.js marks <html> .js before the first paint), none until shop.js knows which; without it, the
   home view */
.js [data-view] { display: none; }
.js [data-view].is-shown { display: block; }

/* ------------------------------------------------------------------ header: Purchases, on the account site, is a text
   link with the up-right arrow, without the underline the header's other links don't have either */
.nav .link-point { text-decoration: none; }

/* ------------------------------------------------------------------ panels: a page's boxes */
.panel {
  margin-bottom: 18px;
  padding: clamp(20px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel > :last-child { margin-bottom: 0; }
.panel h1 { font-size: clamp(1.5rem, 1.3rem + .9vw, 1.9rem); }
/* the home page's welcome: a little more presence than the other panels */
#home .panel { padding: clamp(24px, 5vw, 40px); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 55%); }
#home .panel h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.5rem); }
#home .panel > p { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }

/* ------------------------------------------------------------------ messages */
.note { padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--info) 25%, var(--line)); border-radius: var(--radius-sm); background: var(--info-bg); }
.note--error { border-color: color-mix(in srgb, var(--error) 35%, var(--line)); background: var(--error-bg); }
#notice { margin-bottom: 18px; }
/* a page's notice can be closed (dom.js notify): a small, quiet × at its top right, as on the account site */
.note:has(> .note__close) { display: flow-root; }
.note__close {
  float: right;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  margin: -2px -6px 0 10px;
  padding: 0; border: 0; border-radius: 7px;
  background: none; color: inherit; opacity: .65;
  cursor: pointer;
}
.note__close:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.note__close svg { width: 16px; height: 16px; }
.note:has(> .note__close) { container-type: inline-size; }
@container (max-width: 8rem) {
  .note__close { float: none; margin: -2px -6px 4px auto; }
}

/* ------------------------------------------------------------------ buttons: two layouts of ours
   .btn--block fills its column up to 320px (the widest any button is); a panel's own main button sits in the middle */
.btn--block { display: flex; width: 100%; height: auto; min-height: 46px; padding-block: 10px; line-height: 1.2; text-align: center; }
.panel > .btn--block, .btn--center { margin-inline: auto; }
.panel > .btn:not(:last-child) { margin-bottom: 16px; }

/* ------------------------------------------------------------------ forms: the app picker
   The label and its dropdown on one row while there's room; the dropdown goes under the label when it would get
   narrower than 12rem. It fills its column up to 320px, as buttons do */
label { display: block; font-weight: 550; margin-bottom: 6px; }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 22px; }
.field label { margin: 0; font-weight: 600; }
.field .select { flex: 1 1 12rem; max-width: 20rem; }

/* ------------------------------------------------------------------ an app's page: a page head, then the items as
   cards in a grid, "Page N of M" and the pager over and under them. What the base cards don't have: the price and the
   button at the card's foot, and a card with no image */
/* the "Sign in to buy" card stays one column wide, in the middle of the page */
.wrap--wide #sign-in-card { max-width: var(--panel); margin-inline: auto; }
/* the app's name at the left and the account's balances at the right, on one row; when both don't fit, the balances
   go under the name, at the right still */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.page-head h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* the balances as games show them: the currency's icon, an image or a character, or its name as a tag (.chip) when it
   has none, then the amount, its digits all one width */
.wallet {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px 14px;
  margin: 0 0 0 auto; padding: 0; list-style: none;
}
.wallet__item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.wallet__icon { width: 26px; height: 26px; object-fit: contain; }
/* a character (apps.ts `icon`: an emoji or a symbol) as big as the images, in the text's colour unless it's a
   coloured emoji */
.wallet__icon--char { display: inline-grid; place-items: center; font-size: 1.4rem; line-height: 1; }
.wallet__amount { font-weight: 700; font-size: 1.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.card--noart { grid-template-columns: minmax(0, 1fr); }
/* the price at the left, the button (Buy) or tag (Owned) at the right, at the card's foot; under each other when the
   card is too narrow for both */
.card__buy {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
  margin-top: auto; padding-top: 16px;
}
.card__buy .price { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.card__buy .item-action:empty { display: none; }
.card__desc + .card__buy { margin-top: auto; }
.card__body > .card__desc { margin-bottom: 4px; }
/* an item's prices in its app's currencies after its money price, "$1.99 or 🪙 500 in app": each currency's mark (the
   size of the text) and the amount, kept together; the joining words in the body's weight, muted */
.cost { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; vertical-align: bottom; }
.cost__icon { width: 1.3em; height: 1.3em; object-fit: contain; }
.cost__icon--char { display: inline-grid; place-items: center; font-size: 1.25em; line-height: 1; width: 1.04em; height: 1.04em; }
.cost-word { color: var(--muted); font-weight: 400; }
/* "or" (and "+") between the prices, with more room before and after than a space */
.cost-word--join { margin-inline: .35em; }

/* ------------------------------------------------------------------ the payment page: once the checkout is closed
   unpaid, "Open the checkout again" and "Cancel, go back", one under the other in the middle */
.pay-actions { display: grid; gap: 14px; margin-top: 6px; }
.pay-actions[hidden] { display: none; }

/* ------------------------------------------------------------------ confirmation windows (dom.js ask()), 520px wide as
   on the account site, with the message and one button in their body */
.window { width: min(100% - 32px, 520px); }
.window__body > * + * { margin-top: 14px; }
.window__message { line-height: 1.55; color: var(--muted); }
.window__message > :last-child { margin-bottom: 0; }
.window__actions { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; margin-top: 20px; }
.window__actions > .btn { width: 100%; }

/* ------------------------------------------------------------------ narrow screens. Nothing shrinks */
/* under 260px a long button label or tag goes onto more lines instead of out of its box */
@media (max-width: 259px) {
  .panel .btn, .window__body .btn { flex-wrap: wrap; height: auto; min-height: 46px; padding: 8px 12px; line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere; }
  .chip { white-space: normal; overflow-wrap: anywhere; }
}
