/* ==========================================================================
   Store: catalogue, product pages, checkout, order pages and the store admin.
   Built on the site.css tokens. The page artifact is a `pkg search` terminal,
   prices sit in the same notched readout the altitude tape uses, and product
   specs are stamped on an avionics data plate.
   ========================================================================== */

@layer site {

/* ---------- Terminal: package listing ---------- */
.pkg td, .pkg th { white-space: nowrap; }
.pkg td:last-child, .pkg th:last-child { width: auto; text-align: right; }
.pkg .pkg-name { width: 100%; }
.pkg .pkg-free { color: var(--t-ok); }
@media (max-width: 560px) { .pkg .pkg-type { display: none; } }

/* ---------- Price readout (the tape's notched box, lit on hover) ---------- */
.price-ro {
  --ro-edge: var(--rule-2); --ro-fill: var(--paper); --notch-w: 10px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center;
  height: 2.5rem; padding: 0 calc(0.9rem + var(--notch-w)) 0 0.9rem;
  font-family: var(--font-data); font-size: 1.02rem; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--ink); background: var(--ro-edge);
  clip-path: polygon(0 0, calc(100% - var(--notch-w)) 0, 100% 50%, calc(100% - var(--notch-w)) 100%, 0 100%);
  transition: color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.price-ro::before {
  content: ""; position: absolute; inset: 1px; z-index: -1;
  background: var(--ro-fill); clip-path: inherit;
  transition: background-color 0.2s var(--ease-out);
}
.price-ro--lit { --ro-edge: var(--signal); --ro-fill: var(--readout); color: var(--readout-ink); }

/* ---------- Catalogue ---------- */
.shelf { padding-block: clamp(2rem, 4.5vw, 3.25rem) 0; }
.shelf-list { list-style: none; border-top: 1px solid var(--rule-2); }
.item {
  position: relative;
  display: grid; grid-template-columns: clamp(9rem, 17vw, 13.5rem) minmax(0, 1fr) auto;
  gap: 0.5rem clamp(1.25rem, 3vw, 2.5rem); align-items: center;
  padding-block: clamp(1.25rem, 2.6vw, 1.75rem);
  border-bottom: 1px solid var(--rule);
}
.item-media, .glyph {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: 4px; border: 1px solid var(--rule); background: var(--paper-2);
}
.item-media img { width: 100%; height: 100%; object-fit: cover; }
.glyph {
  display: grid; place-items: center; color: var(--ink-3);
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem; background-position: -1px -1px;
}
.glyph svg { width: 34%; height: 34%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; background: var(--paper-2); padding: 6%; box-sizing: content-box; border-radius: 50%; }
.item-main { min-width: 0; }
.item-meta { color: var(--ink-3); }
.item-name { margin-top: 0.4rem; font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-stretch: 78%; font-weight: 780; line-height: 1; letter-spacing: -0.005em; }
.item-name a { transition: color 0.18s; }
.item-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.item-name a:focus-visible { outline: none; }
.item:has(.item-name a:focus-visible) { outline: 2px solid var(--signal); outline-offset: 4px; }
.item-tag { margin-top: 0.55rem; max-width: 40rem; color: var(--ink-2); }
.item-buy { display: grid; justify-items: end; gap: 0.45rem; }
.price-alt { color: var(--ink-3); }
.item-sold { color: var(--ink-2); }
/* Copies sold: the one number worth a highlight */
.sold-chip {
  display: inline-flex; align-items: baseline; gap: 0.3rem; padding: 0.18rem 0.6rem 0.22rem;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--signal) 35%, transparent); background: var(--signal-wash);
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 550; letter-spacing: 0; color: var(--ink-2); white-space: nowrap;
}
.sold-chip b { font-size: 1.1rem; font-stretch: 78%; font-weight: 800; line-height: 1; color: var(--signal); font-variant-numeric: tabular-nums; }
.off-badge {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.16rem 0.55rem; border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--caution) 55%, transparent); color: var(--caution);
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 650; white-space: nowrap;
}
.off-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.buy-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.item-off { font-size: 0.85rem; font-weight: 650; color: var(--caution); white-space: nowrap; }

.prod-sold { color: var(--ink); }
.item:focus-within .price-ro { --ro-edge: var(--signal); --ro-fill: var(--readout); color: var(--readout-ink); }
@media (hover: hover) and (pointer: fine) {
  .item:hover .item-name a { color: var(--signal); }
  .item:hover .price-ro { --ro-edge: var(--signal); --ro-fill: var(--readout); color: var(--readout-ink); }
}
@media (max-width: 760px) {
  .item { grid-template-columns: 5.75rem minmax(0, 1fr); align-items: start; gap: 0.75rem 1rem; }
  .item-name { font-size: 1.8rem; margin-top: 0.25rem; }
  .item-tag { margin-top: 0.4rem; font-size: 0.98rem; }
  .item-buy { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-items: start; gap: 0.5rem 0.75rem; }
  .item-buy .off-badge { order: 3; }
  .price-ro { height: 2.2rem; font-size: 0.95rem; }
}

/* Category shelves */
.cat + .cat { margin-top: clamp(2.75rem, 6vw, 4.25rem); }
.cat-head { display: flex; align-items: center; gap: 0.9rem 1rem; padding-bottom: 1.1rem; }
.cat-icon { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 10px; object-fit: contain; }
.cat-copy { min-width: 0; }
.cat-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-stretch: 78%; font-weight: 780; line-height: 1; }
.cat-head p { margin-top: 0.4rem; max-width: 40rem; color: var(--ink-2); font-size: 0.98rem; }
.cat-count { margin-left: auto; align-self: flex-end; color: var(--ink-3); white-space: nowrap; }
.glyph img { width: 34%; height: auto; border-radius: 16%; }
.prod-cat { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.2em; }
.prod-cat:hover { color: var(--signal); }
.prod-cat img { width: 1.15rem; height: 1.15rem; border-radius: 3px; }
@media (max-width: 560px) { .cat-count { display: none; } .cat-icon { width: 2.4rem; height: 2.4rem; } }

.shelf-empty { padding: clamp(2rem, 5vw, 3rem) 0; border-bottom: 1px solid var(--rule); display: grid; gap: 0.9rem; justify-items: start; max-width: 38rem; }
.shelf-empty h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-stretch: 80%; font-weight: 780; }
.shelf-empty p { color: var(--ink-2); }

.owned { margin-bottom: clamp(2rem, 4vw, 2.75rem); padding: 1rem 1.15rem; border: 1px solid var(--rule-2); border-left: 3px solid var(--go); border-radius: 6px; background: var(--panel); }
.owned h2 { font-size: 1.05rem; font-stretch: 88%; font-weight: 720; }
.owned ul { list-style: none; margin-top: 0.5rem; display: grid; gap: 0.35rem; }
.owned li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.9rem; }
.owned a { font-weight: 650; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.2em; }
.owned a:hover { color: var(--signal); text-decoration-color: currentColor; }
.owned .data { color: var(--ink-3); }

/* How buying works: two payment routes merging into one destination, drawn
   like airways on the chart. The route line is the only accent. */
.howto { padding-block: clamp(4rem, 9vw, 6.5rem) 0; }
.howto-head { display: grid; gap: 0.8rem; max-width: 40rem; margin-bottom: clamp(2.5rem, 6vw, 3.75rem); }
.howto-head h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-stretch: 78%; font-weight: 780; line-height: 0.95; letter-spacing: -0.01em; }
.howto-head p { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--ink-2); }

.merge {
  --line: 2px; --dot: 11px; --curve: 18px;
  display: grid;
  grid-template-columns: minmax(0, 25rem) minmax(5rem, 1fr) minmax(0, 23rem);
  grid-template-rows: 1fr 1fr;
}
.route { position: relative; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0 0.9rem; align-items: center; padding: 1.1rem 1.75rem 1.1rem 0; }
.route--in { grid-column: 1; grid-row: 1; }
.route--out { grid-column: 1; grid-row: 2; }
.route-cur { font-size: 2.6rem; font-stretch: 75%; font-weight: 800; line-height: 1; color: var(--ink); text-align: center; }
.route h3, .merge-dest h3 { font-size: clamp(1.3rem, 2.1vw, 1.55rem); font-stretch: 82%; font-weight: 760; line-height: 1.1; }
.route p, .merge-dest p { margin-top: 0.3rem; color: var(--ink-2); }
/* where each route leaves its box */
.route::after {
  content: ""; position: absolute; right: calc(var(--dot) / -2); top: 50%;
  width: var(--dot); height: var(--dot); border-radius: 50%; transform: translateY(-50%);
  background: var(--signal); box-shadow: 0 0 0 4px var(--paper); z-index: 1;
}
.merge-join { grid-column: 2; grid-row: 1 / 3; position: relative; }
.merge-join::before, .merge-join::after {
  content: ""; position: absolute; left: 0; right: 50%; height: 25%;
  border: 0 solid var(--signal); border-right-width: var(--line);
}
.merge-join::before { top: 25%; border-top-width: var(--line); border-top-right-radius: var(--curve); }
.merge-join::after { top: 50%; border-bottom-width: var(--line); border-bottom-right-radius: var(--curve); transform: translateY(calc(var(--line) * -1)); }
.merge-out { position: absolute; left: 50%; right: 0; top: 50%; height: var(--line); background: var(--signal); transform: translateY(-50%); }
.merge-fix {
  position: absolute; left: 50%; top: 50%; width: var(--dot); height: var(--dot); border-radius: 50%;
  transform: translate(calc(-50% + var(--line) / 2), -50%); background: var(--signal); box-shadow: 0 0 0 4px var(--paper);
}
.merge-dest { grid-column: 3; grid-row: 1 / 3; align-self: center; position: relative; padding-left: 1.75rem; }
/* destination: the chart's ring, like the "you are here" fix on the home page */
.merge-dest::before {
  content: ""; position: absolute; left: calc(var(--dot) * -0.5 - 1px); top: 50%;
  width: 13px; height: 13px; border-radius: 50%; transform: translateY(-50%);
  border: 2px solid var(--signal); background: var(--paper); box-sizing: border-box;
}
.merge-dest::after {
  content: ""; position: absolute; left: calc(-1px - 1.5px); top: 50%; width: 5px; height: 5px;
  border-radius: 50%; background: var(--signal); transform: translate(0, -50%);
}

/* Phones: the two routes sit side by side and merge downward into the destination. */
@media (max-width: 760px) {
  .merge { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 3.5rem auto; column-gap: 1rem; }
  .route { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 0 0 1rem; gap: 0.35rem; }
  .route--in { grid-column: 1; grid-row: 1; }
  .route--out { grid-column: 2; grid-row: 1; }
  .route-cur { font-size: 2.2rem; }
  .route::after { right: auto; left: 50%; top: auto; bottom: calc(var(--dot) / -2); transform: translateX(-50%); }
  .merge-join { grid-column: 1 / -1; grid-row: 2; }
  .merge-join::before, .merge-join::after { top: 0; height: 50%; border-width: 0; transform: none; }
  .merge-join::before { left: calc(25% - 0.25rem); right: 50%; border-left-width: var(--line); border-bottom-width: var(--line); border-bottom-left-radius: var(--curve); }
  .merge-join::after { left: 50%; right: calc(25% - 0.25rem); border-right-width: var(--line); border-bottom-width: var(--line); border-bottom-right-radius: var(--curve); }
  .merge-out { left: 50%; right: auto; top: 50%; bottom: 0; width: var(--line); height: auto; transform: translateX(-50%); }
  .merge-fix { transform: translate(-50%, calc(-50% + var(--line) / 2)); }
  .merge-dest { grid-column: 1 / -1; grid-row: 3; text-align: center; padding: 1.1rem 0 0; max-width: 22rem; justify-self: center; }
  .merge-dest::before { left: 50%; top: calc(-13px / 2); transform: translateX(-50%); }
  .merge-dest::after { left: 50%; top: calc(-5px / 2); transform: translateX(-50%); }
}

.howto-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(3rem, 7vw, 4.5rem); border-top: 1px solid var(--rule-2);
}
.howto-facts > div { padding-top: 1rem; }
.howto-facts dt { font-weight: 650; color: var(--ink); }
.howto-facts dd { margin-top: 0.25rem; color: var(--ink-2); }
@media (max-width: 560px) {
  .howto-facts { grid-template-columns: 1fr; border-top: 0; }
  .howto-facts > div { padding: 0.85rem 0; border-top: 1px solid var(--rule); }
}

.recover {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 27rem); gap: 1rem clamp(2rem, 5vw, 4rem); align-items: center;
  margin-top: clamp(2.5rem, 6vw, 3.5rem); padding-top: clamp(1.5rem, 3vw, 2rem); border-top: 1px solid var(--rule);
}
.recover-copy h3 { font-size: 1.15rem; font-stretch: 88%; font-weight: 720; line-height: 1.2; }
.recover-copy p { margin-top: 0.25rem; color: var(--ink-2); font-size: 0.95rem; }
.recover-field { display: flex; gap: 0.5rem; }
.recover-field .form-input { flex: 1; min-width: 0; }
.recover-field .btn { min-height: 2.9rem; flex: none; }
.recover-status { grid-column: 1 / -1; }
.recover-status:empty { display: none; }
.recover-ok { color: var(--go); font-size: 0.93rem; }
@media (max-width: 760px) { .recover { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Product page ---------- */
.prod { position: relative; padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 3vw, 2rem); }
.prod::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 30rem; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 6.5rem 6.5rem;
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent 90%);
  mask-image: linear-gradient(180deg, #000 10%, transparent 90%);
}
.prod-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(19rem, 24rem);
  grid-template-areas: "head buy" "body buy";
  gap: 0 clamp(2rem, 5vw, 4.5rem); align-items: start;
}
.prod-head { grid-area: head; display: grid; gap: 1.1rem; padding-bottom: clamp(1.75rem, 4vw, 2.75rem); min-width: 0; }
.prod-head .prompt a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.2em; }
.prod-head .prompt a:hover { color: var(--signal); }
.prod-kicker { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--ink-3); }
.prod-buy { grid-area: buy; position: sticky; top: calc(var(--nav-h) + 1.25rem); min-width: 0; }
.prod-body { grid-area: body; display: grid; gap: clamp(2.25rem, 5vw, 3.25rem); min-width: 0; }
.prod-body h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-stretch: 82%; font-weight: 760; line-height: 1.1; margin-bottom: 0.9rem; }
.prod-shot img { aspect-ratio: auto; max-height: 36rem; object-fit: contain; background: var(--paper-2); }
.prod-desc { max-width: 40rem; }
.prod-desc h2, .prod-desc h3 { color: var(--ink); font-stretch: 85%; margin: 1.6rem 0 0.6rem; line-height: 1.15; }
.prod-desc h2 { font-size: 1.4rem; }
.prod-desc h3 { font-size: 1.15rem; }
.prod-desc ul, .prod-desc ol { padding-left: 1.2rem; margin-top: 0.75rem; }
.prod-desc li + li { margin-top: 0.35rem; }
.prod-desc li::marker { color: var(--signal); }
.prod-desc code { font-family: var(--font-data); font-size: 0.86em; padding: 0.1em 0.35em; border-radius: 3px; background: var(--paper-2); border: 1px solid var(--rule); }
.prod-desc pre { margin-top: 0.9rem; padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; background: #0b1118; color: #d6dee8; font-family: var(--font-data); font-size: 0.82rem; line-height: 1.65; }
.prod-desc pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.prod-desc > :first-child { margin-top: 0; }
.prod-desc p + ul, .prod-desc p + ol, .prod-desc ul + p, .prod-desc ol + p { margin-top: 0.9rem; }

.gallery { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.gallery button { display: block; width: 100%; border-radius: 4px; overflow: hidden; border: 1px solid var(--rule-2); background: var(--paper-2); cursor: zoom-in; transition: border-color 0.18s; }
.gallery button:hover { border-color: var(--ink-3); }
.gallery img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }

.notes { max-width: 40rem; padding-left: 1.1rem; border-left: 2px solid var(--blue); }

@media (max-width: 960px) {
  .prod-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "buy" "body"; }
  .prod-buy { position: static; margin-bottom: clamp(2.25rem, 6vw, 3rem); }
}
@media (max-width: 520px) { .gallery { grid-template-columns: 1fr; } }

/* ---------- Buy panel ---------- */
.buy { border: 1px solid var(--rule-2); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.buy-top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem 1rem; padding: 1.15rem 1.25rem 1rem; border-bottom: 1px solid var(--rule); }
.buy-price { font-size: clamp(2.5rem, 4vw, 3.1rem); font-stretch: 75%; font-weight: 800; line-height: 0.9; font-variant-numeric: tabular-nums; }
.buy-alt { color: var(--ink-3); }
.buy-form { display: grid; gap: 1.05rem; padding: 1.1rem 1.25rem 1.25rem; }
.pay-opts { border: 0; display: grid; gap: 0.5rem; min-width: 0; }
.pay-opts legend { padding: 0; margin-bottom: 0.45rem; font-size: 0.9rem; font-weight: 600; }
.pay-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.1rem 0.7rem; align-items: center;
  padding: 0.75rem 0.85rem; border: 1px solid var(--rule-2); border-radius: 6px; cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s;
}
.pay-opt input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--signal); }
.pay-opt:hover { border-color: var(--ink-3); }
.pay-opt:has(input:checked) { border-color: var(--signal); background: var(--signal-wash); }
.pay-opt:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.pay-opt-name { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 650; }
/* Brand marks sit on a white chip so the dark brand colours read in both themes */
.pay-mark { flex: none; width: 1.6rem; height: 1.6rem; padding: 0.22rem; border-radius: 5px; background: #fff; box-shadow: 0 0 0 1px var(--rule-2); }
.pay-opt-amt { font-family: var(--font-data); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.pay-opt-note { grid-column: 2 / -1; font-size: 0.85rem; color: var(--ink-3); line-height: 1.4; }
.buy-form .form-input { min-height: 3rem; }
.buy-go { width: 100%; min-height: 3.25rem; font-size: 1.05rem; transition: background-color 0.18s, transform 0.14s var(--ease-out); }
.buy-go:active { transform: scale(0.98); }
.buy-go[aria-busy="true"] { cursor: progress; opacity: 0.85; }
.buy-go .spin { display: none; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.buy-go[aria-busy="true"] .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.buy-note { font-size: 0.85rem; color: var(--ink-3); line-height: 1.45; }
.buy-msg { font-size: 0.92rem; line-height: 1.45; }
.buy-msg:empty { display: none; }
.buy-msg--err { color: var(--stop); }
.buy-msg--ok { color: var(--go); }
.buy-test { padding: 0.7rem 0.8rem; border-radius: 6px; border: 1px dashed var(--caution); background: color-mix(in srgb, var(--caution) 8%, transparent); color: var(--ink-2); font-size: 0.86rem; line-height: 1.45; }
.buy-test b { color: var(--caution); font-weight: 650; }
.buy-test code { font-family: var(--font-data); font-size: 0.85em; color: var(--ink); }
.buy-off { display: grid; gap: 0.25rem; padding: 0.8rem 0.9rem; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--paper-2); color: var(--ink-2); font-size: 0.92rem; line-height: 1.45; }
.buy-off b { color: var(--ink); font-size: 1rem; }
.buy-form--off .pay-opts { opacity: 1; }
.pay-opt.is-off { cursor: not-allowed; border-style: dashed; }
.pay-opt.is-off:hover { border-color: var(--rule-2); }
.pay-opt.is-off .pay-opt-amt, .pay-opt.is-off .pay-opt-note { color: var(--ink-3); }
.buy-go:disabled { background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--rule-2); cursor: not-allowed; transform: none; }
.buy-price.is-off { color: var(--ink-2); }
.buy-off-note { color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; }

.buy-closed { padding: 1.1rem 1.25rem 1.25rem; display: grid; gap: 0.6rem; color: var(--ink-2); font-size: 0.95rem; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.draft-flag { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.6rem; border-radius: 4px; border: 1px dashed var(--caution); color: var(--caution); font-size: 0.85rem; width: fit-content; }
@media (prefers-reduced-motion: reduce) { .buy-go .spin { animation-duration: 1.6s; } }

/* ---------- Data plate ---------- */
.plate {
  --rivet: color-mix(in srgb, var(--ink-3) 80%, transparent);
  position: relative; max-width: 34rem;
  padding: 1rem 1.5rem 1.15rem;
  border: 1.5px solid var(--ink-3); border-radius: 6px;
  background: var(--paper-2);
  font-family: var(--font-data);
}
.plate::before {
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  background:
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.6px) left top / 8px 8px no-repeat,
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.6px) right top / 8px 8px no-repeat,
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.6px) left bottom / 8px 8px no-repeat,
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.6px) right bottom / 8px 8px no-repeat;
}
.plate-title { margin-bottom: 0.6rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--rule-2); text-align: center; font-size: 0.72rem; letter-spacing: 0.14em; color: var(--ink-2); }
.plate dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1.4rem; font-size: 0.8rem; }
.plate dt { color: var(--ink-3); letter-spacing: 0.06em; }
.plate dd { color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.plate dd a { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.2em; }
.plate dd a:hover { color: var(--signal); }

/* ---------- Order page ---------- */
.order-page { position: relative; padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 3vw, 2rem); }
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.order-main { display: grid; gap: 1.35rem; min-width: 0; align-content: start; }
.order-lamp { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink-2); }
.order-lamp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.order-lamp--paid::before { background: var(--go); box-shadow: 0 0 0 3px color-mix(in srgb, var(--go) 18%, transparent); }
.order-lamp--pending::before { background: var(--caution); }
.order-lamp--failed::before, .order-lamp--cancelled::before { background: var(--stop); }
.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.4rem; margin-top: 0.35rem; }
.order-actions .btn { min-height: 3.25rem; }
.order-actions .buy-go { width: auto; padding-inline: 1.6rem; }
.order-small { font-size: 0.9rem; color: var(--ink-3); max-width: 36rem; }
.key-block { display: grid; gap: 0.5rem; max-width: 34rem; }
.key-block .form-label { font-weight: 600; }
.key-ro {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem; border-radius: 6px; border-left: 3px solid var(--signal);
  background: var(--readout); color: var(--readout-ink);
  font-family: var(--font-data); font-size: clamp(0.95rem, 2.6vw, 1.2rem); letter-spacing: 0.06em;
}
.key-ro code { font: inherit; overflow-wrap: anywhere; }
.key-ro.is-revoked code { text-decoration: line-through; opacity: 0.6; }
.copy-btn {
  flex: none; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.25rem; padding: 0 0.75rem; border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22); color: inherit;
  font-family: var(--font-data); font-size: 0.72rem; letter-spacing: 0.04em;
  transition: border-color 0.18s, transform 0.14s var(--ease-out);
}
.copy-btn:hover { border-color: var(--signal); }
.copy-btn:active { transform: scale(0.97); }
.copy-btn--light { border-color: var(--rule-2); color: var(--ink-2); }
.copy-btn--light:hover { color: var(--ink); }
.receipt .term-screen { min-height: 0; max-height: none; padding-bottom: 1rem; }
.receipt-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.75rem; }
.receipt-row > span:first-child { color: var(--t-dim); }
.receipt-row > span:last-child { overflow-wrap: anywhere; }
@media (max-width: 900px) { .order-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .receipt-row { grid-template-columns: 6rem minmax(0, 1fr); } }

/* ---------- Screenshot viewer ---------- */
.sbox {
  width: min(100% - 1.5rem, 72rem); max-width: none; max-height: calc(100dvh - 1.5rem);
  margin: auto; padding: 0.8rem;
  border: 1px solid var(--rule-2); border-radius: 8px; background: var(--panel); color: var(--ink);
}
.sbox[open] { animation: sbox-in 0.2s var(--ease-out); }
.sbox::backdrop { background: rgba(6, 10, 16, 0.8); }
.sbox[open]::backdrop { animation: sbox-fade 0.2s var(--ease-out); }
@keyframes sbox-in { from { opacity: 0; transform: scale(0.98); } }
@keyframes sbox-fade { from { opacity: 0; } }
.sbox img { display: block; width: 100%; max-height: calc(100dvh - 6rem); object-fit: contain; border-radius: 4px; }
.sbox-close {
  position: absolute; top: 1.2rem; right: 1.2rem; z-index: 1;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--rule-2);
}
.sbox-close svg, .dlg svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { .sbox[open], .sbox[open]::backdrop, .dlg[open], .dlg[open]::backdrop { animation: none; } }

/* ---------- Status badges for the store ---------- */
.status-paid, .status-published { color: var(--go); border-color: color-mix(in srgb, var(--go) 45%, transparent); }
.status-pending, .status-draft { color: var(--caution); border-color: color-mix(in srgb, var(--caution) 45%, transparent); }
.status-refunded, .status-archived, .status-cancelled { color: var(--ink-3); }
.status-test { color: var(--caution); border-style: dashed; border-color: color-mix(in srgb, var(--caution) 55%, transparent); }
.status-test::before { display: none; }
.status-failed { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 45%, transparent); }

/* ==========================================================================
   Store admin
   ========================================================================== */
.sadm { padding-block: clamp(2rem, 5vw, 3rem) clamp(3rem, 7vw, 4.5rem); }
.sadm-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.25rem; }
.sadm-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-stretch: 75%; font-weight: 800; line-height: 0.92; letter-spacing: -0.01em; }
.sadm-head p { color: var(--ink-2); margin-top: 0.6rem; max-width: 40rem; }
.sadm-head-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sadm-tabs { display: flex; gap: 0.15rem; margin-bottom: clamp(1.5rem, 3vw, 2rem); border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.sadm-tabs a { padding: 0.7rem 0.85rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 600; white-space: nowrap; transition: color 0.18s; }
.sadm-tabs a:hover { color: var(--ink); }
.sadm-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }
.sadm-tabs .data { margin-left: 0.3rem; color: var(--ink-3); }

.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1.5rem; margin-bottom: clamp(1.75rem, 4vw, 2.5rem); }
.ledger > div { min-width: 0; }
.ledger dt { font-size: 0.85rem; color: var(--ink-3); }
.ledger dd { margin-top: 0.2rem; font-size: clamp(1.6rem, 3vw, 2.2rem); font-stretch: 78%; font-weight: 780; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ledger dd small { display: block; margin-top: 0.15rem; font-family: var(--font-data); font-size: 0.78rem; font-weight: 400; font-stretch: 100%; color: var(--ink-3); }
@media (max-width: 760px) { .ledger { grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; } }

.sadm-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1000px) { .sadm-grid { grid-template-columns: 1fr; } }
.sadm-panel { border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); min-width: 0; }
.sadm-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--rule); }
.sadm-panel-head h2 { font-size: 1.05rem; font-stretch: 88%; font-weight: 720; }
.sadm-panel-body { padding: 1rem 1.1rem 1.15rem; }
.sadm-panel .admin-table-wrap { border: 0; border-radius: 0 0 8px 8px; }
.sadm-panel .cl { padding: 0.25rem 1.1rem 0.6rem; }
.sadm-panel .cl-resp { max-width: 60%; }
.cl-resp .done { color: var(--go); }
.cl-resp .todo { color: var(--caution); }

/* Positioned so absolutely placed children (sr-only labels) stay inside the scroll box */
.sadm .admin-table-wrap { position: relative; }
.admin-table .num { text-align: right; font-family: var(--font-data); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table .sub { display: block; color: var(--ink-3); font-size: 0.82rem; margin-top: 0.1rem; }
.admin-table .mono { font-family: var(--font-data); font-size: 0.8rem; }
.admin-table a.row-link { font-weight: 650; }
.admin-table a.row-link:hover { color: var(--signal); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table td.empty { padding: 1.5rem 0.85rem; color: var(--ink-3); }

.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: 0.75rem; align-items: end; margin-bottom: 1.25rem; }
.filters .form-group { margin: 0; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .filters .form-group:first-child { grid-column: 1 / -1; } }

.sadm-form { display: grid; gap: 1.25rem; max-width: 60rem; }
.fs { border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); padding: 1.1rem clamp(1.1rem, 3vw, 1.5rem) 1.35rem; display: grid; gap: 1.1rem; min-width: 0; }
/* Fields sit on a shared top line; a hint under one never stretches its neighbour */
.sadm-form .form-grid-2, .sadm-form .form-grid-3 { align-items: start; }
.fs legend { padding: 0 0.45rem; margin-left: -0.45rem; font-size: 1.1rem; font-stretch: 88%; font-weight: 720; }
.fs-lede { color: var(--ink-2); font-size: 0.93rem; margin-top: -0.35rem; }
.form-hint { font-size: 0.82rem; color: var(--ink-3); line-height: 1.45; }
.form-hint a { text-decoration: underline; text-underline-offset: 0.2em; }
.form-group .form-error { margin-top: 0.1rem; }
.form-input[aria-invalid="true"] { border-color: var(--stop); }
.switch { display: flex; align-items: flex-start; gap: 0.7rem; cursor: pointer; }
.switch input { flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.2rem; accent-color: var(--signal); }
.switch b { display: block; font-weight: 650; }
.switch span { color: var(--ink-3); font-size: 0.88rem; }
.input-affix { display: flex; align-items: stretch; }
.input-affix > span { display: grid; place-items: center; min-width: 2.6rem; padding: 0 0.6rem; border: 1px solid var(--rule-2); border-right: 0; border-radius: 6px 0 0 6px; background: var(--paper-2); font-family: var(--font-data); color: var(--ink-2); }
.input-affix .form-input { border-radius: 0 6px 6px 0; }
.form-input[data-price]:read-only { opacity: 0.5; }
.copy-field { display: flex; gap: 0.5rem; align-items: stretch; }
.copy-field .form-input { font-family: var(--font-data); font-size: 0.85rem; color: var(--ink-2); background: var(--paper-2); }
.file-now { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; padding: 0.65rem 0.8rem; border: 1px dashed var(--rule-2); border-radius: 6px; font-size: 0.9rem; }
.file-now .data { color: var(--ink-3); }
.thumbs { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.75rem; }
.thumbs li { display: grid; gap: 0.35rem; }
.thumbs img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.form-actions .btn { min-height: 3rem; }
.danger-zone { border-color: color-mix(in srgb, var(--stop) 35%, transparent); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip-list code { font-family: var(--font-data); font-size: 0.75rem; padding: 0.15rem 0.45rem; border-radius: 3px; border: 1px solid var(--rule-2); background: var(--paper-2); }
.test-result { font-size: 0.9rem; }
.test-result--ok { color: var(--go); }
.test-result--err { color: var(--stop); }

.sfacts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.55rem 1.5rem; font-size: 0.95rem; }
.sfacts dt { color: var(--ink-3); }
.sfacts dd { min-width: 0; overflow-wrap: anywhere; }
.sfacts .mono { font-family: var(--font-data); font-size: 0.85rem; }
.sfacts .mono .form-link { font-family: var(--font-sans); font-size: 0.9rem; }
@media (max-width: 520px) { .sfacts { grid-template-columns: 1fr; gap: 0.1rem; } .sfacts dd { margin-bottom: 0.55rem; } }

.events { list-style: none; display: grid; gap: 0; border-left: 2px solid var(--rule-2); margin-left: 0.3rem; }
.events li { position: relative; padding: 0 0 1rem 1.1rem; }
.events li::before { content: ""; position: absolute; left: -5px; top: 0.45rem; width: 8px; height: 8px; border-radius: 50%; background: var(--panel); border: 2px solid var(--ink-3); }
.events li:last-child { padding-bottom: 0; }
.events li:first-child::before { border-color: var(--signal); background: var(--signal); }
.events time { display: block; font-family: var(--font-data); font-size: 0.72rem; color: var(--ink-3); }
.events p { font-size: 0.93rem; }
.events pre { margin-top: 0.35rem; max-height: 10rem; overflow: auto; padding: 0.5rem 0.65rem; border-radius: 4px; background: var(--paper-2); font-family: var(--font-data); font-size: 0.72rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.action-list { display: grid; gap: 0.6rem; }
.action-list form { display: contents; }
.action-list .btn { justify-content: flex-start; width: 100%; }
.action-list .form-hint { margin: -0.25rem 0 0.35rem; }

/* Confirm dialog for refunds, deletes and revokes */
.dlg {
  width: min(100% - 2rem, 28rem); max-width: none; margin: auto; padding: 0;
  border: 1px solid var(--rule-2); border-radius: 8px; background: var(--panel); color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45);
}
.dlg[open] { animation: sbox-in 0.18s var(--ease-out); }
.dlg::backdrop { background: rgba(6, 10, 16, 0.55); }
.dlg[open]::backdrop { animation: sbox-fade 0.18s var(--ease-out); }
.dlg-body { padding: 1.3rem 1.35rem 0.4rem; display: grid; gap: 0.5rem; }
.dlg-body h2 { font-size: 1.3rem; font-stretch: 85%; font-weight: 760; }
.dlg-body p { color: var(--ink-2); font-size: 0.95rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.35rem 1.25rem; }
.btn--danger { background: var(--stop); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--stop) 85%, #000); }
.btn--sm.btn--danger, .btn--sm.btn--line { min-height: 2.5rem; }

} /* end @layer site */
