/* layeredentropy.com — the shop, dressed as the rest of the site.
 *
 * BTCPay's Point of Sale page is served by BTCPay, not from this directory, so
 * none of its markup is ours to edit. What it does give us is a theme built on
 * ~420 `--btcpay-*` custom properties: redeclare the dozen that carry colour and
 * type and the whole application follows, without a single `!important` fight
 * against Bootstrap.
 *
 * Installed by setting the store's Checkout Appearance -> Custom CSS to
 * https://layeredentropy.com/shop/pos.css — same origin as the shop itself,
 * because the apex serves the app and /shop/ proxies to the static container.
 * It lives at /shop/ and not under a product: this styles the storefront, and
 * draw32 is one of the things sold there. Its companion is pos.js, which puts
 * the per-product "Read more" link in each card.
 * Setting that field back to empty restores stock BTCPay; nothing here is
 * destructive.
 *
 * Dark mode is a second BTCPay stylesheet that redeclares the same properties at
 * the same specificity, switched by toggling its `rel` and setting
 * `data-btcpay-theme` on the root element. So anything tied to a surface has to
 * be written per theme, exactly as style.css does for the pages next door.
 */

@import url("/brand/type.css");

/* ---------- type and brand: the same either way ---------- */

:root {
  --display: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --prose: "Spectral", ui-serif, Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --btcpay-font-family-base: var(--prose);
  --btcpay-font-family-monospace: var(--mono);

  /* Orange carries the brand, and the ink on it is near-black rather than white:
     white on #e8650d is 3.3:1, the dark ink is 5.4:1. The pages next door make
     the same choice with --on-accent. */
  --btcpay-brand-primary: #e8650d;
  --btcpay-brand-secondary: #a9440a;
  --btcpay-brand-tertiary: #a9440a;
  --btcpay-primary: #e8650d;
  --btcpay-primary-accent: #a9440a;
  --btcpay-primary-text: #14171a;
  --btcpay-primary-text-hover: #14171a;
  --btcpay-primary-text-active: #14171a;

  /* A capsule, because the thing you click should have the shape of the thing
     you are buying. */
  --btcpay-border-radius: .5rem;
  --btcpay-border-radius-l: .75rem;
  --btcpay-border-radius-xl: 1rem;
}

/* ---------- light: the page is paper ---------- */

:root:not([data-btcpay-theme="dark"]) {
  --btcpay-body-bg-rgb: 255, 255, 255;
  --btcpay-body-bg-light: #ffffff;
  --btcpay-bg-tile: #ffffff;
  --btcpay-body-text: #14171a;
  --btcpay-body-text-rgb: 20, 23, 26;
  --btcpay-body-text-muted: #5e6468;
  --btcpay-body-border-light: #e4e6e1;
  --btcpay-body-border-medium: #c2c6be;
  --btcpay-neutral-100: #ffffff;
  --btcpay-neutral-200: #f2f3f0;
  --btcpay-neutral-300: #e4e6e1;
}

/* ---------- dark: BTCPay's own neutrals, our ink ---------- */

:root[data-btcpay-theme="dark"] {
  --btcpay-brand-primary: #ff8338;
  --btcpay-primary: #ff8338;
  --btcpay-primary-accent: #ffa972;
  --btcpay-body-bg-rgb: 14, 16, 18;
  --btcpay-body-bg-light: #15181a;
  --btcpay-bg-tile: #15181a;
  --btcpay-body-text: #e9ebe8;
  --btcpay-body-text-rgb: 233, 235, 232;
  --btcpay-body-text-muted: #9aa09f;
  --btcpay-body-border-light: #262a2d;
  --btcpay-body-border-medium: #3b4145;
  --btcpay-neutral-100: #15181a;
  --btcpay-neutral-200: #1d2124;
  --btcpay-neutral-300: #262a2d;
}

/* ---------- masthead ---------- */

.public-page-wrap > header h1,
#cartLabel {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 92%;
  letter-spacing: -.022em;
  font-size: clamp(1.6rem, 4.4vw, 2.3rem);
  line-height: 1.1;
}

/* The header is sticky and sits on the body; a hairline tells it from the grid
   below once the page scrolls, which stock BTCPay leaves to a shadowless edge. */
.public-page-wrap > header.sticky-top {
  border-bottom: 1px solid var(--btcpay-body-border-light);
}

/* The Point of Sale header prints the store name as text and never reaches for
   the store logo; the form and checkout pages print both, as an img.store-logo
   above the name. Either way the lockup is painted here, onto the text, and the
   words stay in the DOM for anything that reads the page rather than looks at
   it. The logo is deployed with the static site, so it is same-origin. */
#PosCart .public-page-wrap > header h1,
#FormView .store-header .store-name {
  width: min(17rem, 68vw);
  aspect-ratio: 651 / 106;
  height: auto;
  background: url("/brand/logo.svg") center/contain no-repeat;
  text-indent: -200vw;
  overflow: hidden;
  white-space: nowrap;
}

:root[data-btcpay-theme="dark"] #PosCart .public-page-wrap > header h1,
:root[data-btcpay-theme="dark"] #FormView .store-header .store-name {
  background-image: url("/brand/logo-dark.svg");
}

/* The store's logoUrl is the square tile, not the lockup, because BTCPay spends
   that one setting on two jobs: the picture at the top of the form and checkout,
   and the <link rel="icon"> that becomes the browser tab icon. A 651x106 lockup
   squeezed into 16px is a smear. So the setting carries the tile, which is what
   a tab wants, and the pages that used to print it as a picture get the lockup
   painted on the heading above instead. The tile needs no dark variant: it is an
   orange square with a white knockout either way.

   On the form the picture is then a duplicate of that heading and goes away. The
   invoice page is where this is unverified — no invoice can be created until the
   node finishes syncing — so there the tile is left visible and merely held to a
   size a square can live at, rather than the lockup's width. */
#FormView .store-logo {
  display: none;
}

.store-logo {
  max-width: 3.5rem;
  max-height: 3.5rem;
  width: auto;
  height: auto;
}

/* ---------- the line above the grid ---------- */

/* BTCPay prints the app's description as raw HTML in a .lead above the items,
   and it is the only place on this page a link can go: item descriptions are
   interpolated with a text binding, so an <a> written there renders as source.
   That is where "Read more about the kit" lives, pointing at /draw32/.
   Set it in the POS app's settings, not the store's. */
#PosCart .lead {
  max-width: 46ch;
  margin: 0 auto 2rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--btcpay-body-text-muted);
}

#PosCart .lead p:last-child {
  margin-bottom: 0;
}

/* Links are the pages' own: body-coloured, with an accent underline that fills
   in on hover. No blue, and no coloured link text. */
#PosCart .lead a {
  color: inherit;
  text-underline-offset: .16em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--btcpay-primary) 55%, transparent);
}

#PosCart .lead a:hover {
  text-decoration-color: var(--btcpay-primary);
}

/* ---------- the item grid ---------- */

/* Bootstrap's negative row margins otherwise extend past the mobile viewport. */
#PosItems { margin-inline: 0; }

#PosItems .tile.card {
  border: 1px solid var(--btcpay-body-border-light);
  border-radius: var(--btcpay-border-radius-l);
  box-shadow: none;
  overflow: hidden;
  padding: 1rem;
  transition: border-color var(--btcpay-transition-duration-fast) ease;
}

/* Stock BTCPay hangs the add-to-cart handler on the whole card — v-on:click on
   .tile.card — so clicking the picture, the title or the description silently
   adds a kit. Ordering should be a decision, not a side effect of reading the
   page. So the card stops being a click target and the button starts being one:
   pointer-events governs what can be hit, not what an event does afterwards, so
   a click on the button still bubbles to the card's own handler and BTCPay's
   script is untouched. The amount input is restored with it — it carries its own
   .stop and would be needed if a colourway were ever priced non-fixed. */
#PosItems .tile.card {
  pointer-events: none;
}

#PosItems .tile.card .btn,
#PosItems .tile.card .form-control {
  pointer-events: auto;
}

/* The card is no longer the thing you click, so it takes its hover from the
   button rather than from itself. */
#PosItems .tile.card:has(.btn:hover),
#PosItems .tile.card:has(.image-link:hover) {
  border-color: var(--btcpay-body-border-medium);
}

/* Four products in a three-wide grid leave an orphan on its own row, which is
   the width Bootstrap picks between 1200 and 1400px. Two-up there pairs them and
   gives the pictures more room; the stock four-up returns above 1400. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  #PosItems.row-cols-xl-3 > * {
    flex: 0 0 auto;
    width: 50%;
  }
}

/* The thumbnails are drawings on a panel, and BTCPay sizes the wrapper to the
   image, so a 192px picture floats in a 345px card with white either side. Let
   the band run the full width in the artwork's own colour instead — #f5f4ef is
   read off the PNG, not guessed, so there is no seam where the two meet. It
   stays light in dark mode because the drawings do. */
#PosItems .img {
  position: relative;
  width: 100%;
  background: #f5f4ef;
  padding-block: .5rem;
  border-bottom: 1px solid var(--btcpay-body-border-light);
}

/* The anchor pos.js lays over the picture, going where "Read more" goes. It has
   to opt back into hit-testing exactly as that link does, and it covers the band
   rather than the image so the whole panel is the target. */
#PosItems .image-link {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  cursor: pointer;
}

/* Card height. Six products in a 928px grid are four narrow columns, and at the
   stock proportions each card stood 539px tall with a band of dead space above
   the Order button: Bootstrap stretches every card in a row to the tallest, and
   the body's auto margin collects the difference. The height comes off the
   padding, the title and the paragraph's trailing margin instead. The picture
   keeps its own size — capping it was tried on 18 November 2026 and rejected by
   the owner; the drawings are the product and they are not to be shrunk. */
#PosItems .card-img-top {
  display: block;
  margin-inline: auto;
  border-radius: 0;
}

#PosItems .card-title {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 100%;
  letter-spacing: -.004em;
  font-size: 1rem;
  line-height: 1.3;
}

#PosItems .card-text {
  font-size: .95rem;
  line-height: 1.55;
  margin-bottom: .25rem;
  color: var(--btcpay-body-text-muted);
}

/* Price: tabular figures, so four cards' prices line up down the column. */
#PosItems .card-body .fw-semibold {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .95rem;
  letter-spacing: -.01em;
}

/* The cart paints the same count again, in its own badge that pos.js never
   sees. Here it renders only while the item is in stock (`v-if="item.inventory"`),
   so there is no out-of-stock case to keep and it goes in CSS. */
#CartItems .badge.inventory {
  display: none;
}

/* The only inventory badge that survives is "out of stock" — pos.js hides the
   count while an item is in stock, because the number is nobody's business but
   yours. Stock BTCPay paints it amber; an outline says it without alarm. */
#PosItems .badge.inventory,
#PosItems .badge.text-bg-warning {
  background: transparent !important;
  color: var(--btcpay-body-text-muted) !important;
  border: 1px solid var(--btcpay-body-border-light);
  font-family: var(--mono);
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: .02em;
  padding: .2rem .45rem;
}

/* The link pos.js adds to each card. The card itself is out of hit-testing, so
   this has to opt back in, exactly as the order button does. Styled like a link
   on the pages next door: body-coloured, with an accent underline that fills in
   on hover. */
#PosItems .product-link {
  pointer-events: auto;
  align-self: start;
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 100%;
  font-size: .85rem;
  color: inherit;
  text-underline-offset: .16em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--btcpay-primary) 55%, transparent);
}

#PosItems .product-link:hover {
  text-decoration-color: var(--btcpay-primary);
}

/* ---------- buttons ---------- */

.btn {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 100%;
  letter-spacing: -.004em;
}

.btn-primary {
  border-radius: 999px;
  border-color: transparent;
  padding-block: .6rem;
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: transparent;
}

/* ---------- the checkout form ---------- */

/* A different page with the same wrapper: /apps/<id>/pos/form, reached from the
   cart. It inherits everything above — palette, faces, the capsule button — but
   its own furniture is stock Bootstrap, so the parts below are what make it
   look like it belongs to the shop rather than merely share its colours. */

/* The form sits on a .tile, which BTCPay floats with a 10px drop shadow. Nothing
   on this site casts a shadow: a card is white with a hairline. */
.tile {
  box-shadow: none;
  border: 1px solid var(--btcpay-body-border-light);
}

/* Labels are furniture, not prose — Archivo, as on the buttons. Help text keeps
   the serif, because it is a sentence, and drops a size so the two stop
   competing: stock BTCPay sets both at 14px and they read as one block. */
#FormView .form-label {
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 100%;
  font-size: .9rem;
  letter-spacing: -.004em;
  color: var(--btcpay-body-text);
  margin-bottom: .35rem;
}

#FormView .form-text {
  font-size: .85rem;
  line-height: 1.5;
  color: var(--btcpay-body-text-muted);
  margin-top: .4rem;
}

/* Seven of the eight fields are required, so a red star against each one is
   noise rather than warning. Bootstrap draws it as [data-required]::after in
   --btcpay-danger; keep the mark, lose the alarm. The .text-danger spans next to
   each field are validation messages and stay red, which is what red is for. */
#FormView .form-label[data-required]::after {
  color: var(--btcpay-body-text-muted);
}

#FormView .form-control:focus,
#FormView .form-select:focus {
  border-color: var(--btcpay-primary);
  box-shadow: 0 0 0 .2rem rgba(232, 101, 13, .22);
}

#FormView .form-group + .form-group {
  margin-top: 1.25rem;
}

/* The order button on the shop runs the width of its card; the button that
   actually places the order should not be smaller than it. */
#FormView form .btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
}

/* ---------- cart ---------- */

#cart .table > :not(caption) > * > * {
  border-color: var(--btcpay-body-border-light);
}

#cart .offcanvas-body h6 {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 96%;
}

#cart .offcanvas-body,
#cart .table {
  font-size: .95rem;
}

#cart td,
#cart th {
  font-variant-numeric: tabular-nums;
}

/* ---------- footer ---------- */

.store-footer {
  border-top: 1px solid var(--btcpay-body-border-light);
  margin-top: 3.25rem;
  padding-top: 1.25rem;
}

/* The footer carries the shop-wide links pos.js adds. BTCPay centres a single
   credit in there; with something beside it the row needs to be a row. */
.store-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem 1.25rem;
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 100%;
  font-size: .8rem;
}

.store-links a {
  color: var(--btcpay-body-text-muted);
  text-decoration: none;
}

.store-links a[href="/legal/withdraw"] {
  color: var(--btcpay-body-text);
  text-decoration: underline;
  text-underline-offset: .16em;
}

.store-links a:hover {
  color: var(--btcpay-body-text);
  text-decoration: underline;
  text-underline-offset: .16em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--btcpay-primary);
}

.store-powered-by {
  opacity: .55;
  font-size: .8rem;
}

.store-powered-by:hover {
  opacity: .8;
}

/* ---------- focus, matched to the pages next door ---------- */

:focus-visible {
  outline: 2px solid var(--btcpay-primary);
  outline-offset: 3px;
}
