/* ---------------------------------------------------------------------------
   Fonts (self-hosted, SIL OFL - see /fonts/LICENSE.txt)
--------------------------------------------------------------------------- */
@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ---------------------------------------------------------------------------
   Tokens
--------------------------------------------------------------------------- */
:root {
  --paper: #eef3ef;
  --surface: #ffffff;
  --ink: #1d2a2f;
  --ink-soft: #52626a;
  --line: #c8d4cd;
  --moss: #2f6b45;
  --moss-strong: #22533a;
  --moss-tint: #dcebe1;
  --on-moss: #ffffff;
  --lapis: #2c4c9c;
  --danger: #a33a2c;
  --danger-tint: #f6e1dc;
  --notice: #f3e3b3;
  --receipt-bg: #fdfefc;
  --receipt-ink: #1d2a2f;
  --receipt-soft: #5d6b71;
  --receipt-rule: #b9c5bf;
  --sale: #b03a1a;
  --sale-tint: #fbe6dc;
  --receipt-sale: #b03a1a;

  --display: 'Bricolage', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Atkinson', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.4375rem;
  --step-3: 1.75rem;
  --step-5: clamp(2.5rem, 7vw, 4.25rem);

  --radius: 6px;
  --shell: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131b1f;
    --surface: #1b262b;
    --ink: #e3ebe6;
    --ink-soft: #9bada5;
    --line: #2d3c43;
    --moss: #63b884;
    --moss-strong: #82cc9f;
    --moss-tint: #1d3327;
    --on-moss: #0f1a14;
    --lapis: #9db8ff;
    --danger: #f19584;
    --danger-tint: #3a211d;
    --notice: #4a3d14;
    --sale: #ff9b78;
    --sale-tint: #3b2119;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------------------
   Base
--------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
}
h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.1;
  margin: 0;
}
p {
  margin: 0;
}
a {
  color: var(--lapis);
  text-underline-offset: 0.15em;
}
img {
  display: block;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--lapis);
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 720px) {
  .shell {
    padding-inline: 32px;
  }
}

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 0 1.1em;
  border: 2px solid var(--moss);
  border-radius: var(--radius);
  background: var(--moss);
  color: var(--on-moss);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--moss-strong);
  border-color: var(--moss-strong);
}
.btn-quiet {
  background: transparent;
  color: var(--moss);
}
.btn-quiet:hover {
  background: var(--moss-tint);
  color: var(--moss-strong);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

/* ---------------------------------------------------------------------------
   Header / footer
--------------------------------------------------------------------------- */
.test-banner {
  background: var(--notice);
  color: var(--ink);
  text-align: center;
  font-size: var(--step--1);
  padding: 6px 16px;
}
.masthead {
  padding-top: 40px;
  padding-bottom: 28px;
  display: grid;
  gap: 10px;
}
.brand {
  font-family: var(--display);
  font-size: var(--step-5);
  font-weight: 800;
  font-stretch: 78%;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.brand-small {
  font-size: var(--step-3);
}
.tagline {
  color: var(--ink-soft);
  max-width: 60ch;
}
.address {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: var(--step--1);
}
.address strong {
  font-family: var(--display);
  font-size: var(--step-0);
  letter-spacing: 0.01em;
}
.address:hover {
  border-color: var(--moss);
}
.sales {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-width: 62ch;
}
.sale {
  position: relative;
  padding: 10px 14px 10px 18px;
  background: var(--sale-tint);
  border-radius: var(--radius);
  color: var(--ink);
}
.sale::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--sale);
}
.sale strong {
  font-family: var(--display);
  font-size: var(--step-1);
  color: var(--sale);
}
.sale-ends {
  color: var(--ink-soft);
}

.site-footer {
  margin-top: 72px;
  padding-top: 24px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: var(--step--1);
  display: grid;
  gap: 10px;
}
.site-footer p {
  max-width: 75ch;
}
.disclaimer {
  font-weight: 700;
  color: var(--ink);
}

/* ---------------------------------------------------------------------------
   Store layout
--------------------------------------------------------------------------- */
.layout {
  display: grid;
  gap: 40px;
}
@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 56px;
    align-items: start;
  }
}

/* Who's this for? */
.who {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px 18px;
  align-items: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.who h2 {
  font-size: var(--step-2);
  font-weight: 700;
  grid-column: 2;
}
.head-frame {
  grid-row: 1 / span 3;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  background:
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%) 0 0 / 18px 18px,
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%) 9px 9px / 18px 18px;
  overflow: hidden;
}
.head-frame img {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
}
.who.is-found .head-frame img {
  animation: pop 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes pop {
  from {
    transform: scale(0.4) rotate(-8deg);
    opacity: 0;
  }
}
.player-form {
  grid-column: 2;
  display: grid;
  gap: 6px;
}
.player-form label {
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.field-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.field-row input {
  flex: 1 1 180px;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: var(--step-1);
}
.field-row input:focus {
  border-color: var(--lapis);
  outline: none;
}
.hint {
  grid-column: 2;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.hint.is-error {
  color: var(--danger);
}
.hint.is-ok {
  color: var(--moss);
}
@media (max-width: 480px) {
  .who {
    grid-template-columns: 1fr;
  }
  .who h2,
  .player-form,
  .hint {
    grid-column: 1;
  }
  .head-frame {
    grid-row: auto;
    width: 56px;
    height: 56px;
  }
  .head-frame img {
    width: 56px;
    height: 56px;
  }
}

/* Catalog */
.category {
  margin-top: 44px;
}
.category > h2 {
  font-size: var(--step-3);
  font-weight: 750;
  font-stretch: 85%;
}
.category-note {
  color: var(--ink-soft);
  margin-top: 4px;
  max-width: 62ch;
}
.items {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  border-top: 2px solid var(--ink);
}
.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.item.has-image {
  grid-template-columns: 56px minmax(0, 1fr) auto;
}
.item-image {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
  grid-row: span 2;
}
.item h3 {
  font-size: var(--step-1);
  font-weight: 650;
}
.item-desc {
  color: var(--ink-soft);
  max-width: 60ch;
  grid-column: 1;
}
.item.has-image .item-desc {
  grid-column: 2;
}
.item-note {
  font-size: var(--step--1);
  color: var(--ink-soft);
  margin-top: 4px;
}
.item-buy {
  grid-row: 1 / span 2;
  grid-column: -2;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
}
.price {
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--moss);
  border-radius: var(--radius);
  overflow: hidden;
}
.stepper button {
  width: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--moss);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}
.stepper button:hover:not(:disabled) {
  background: var(--moss-tint);
}
.stepper button:disabled {
  color: var(--line);
  cursor: not-allowed;
}
.stepper output {
  min-width: 2ch;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.price.is-sale {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--sale);
}
.price .was {
  font-size: var(--step-0);
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration-thickness: 1.5px;
}
.sale-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sale-tint);
  color: var(--sale);
  font-family: var(--body);
  font-size: var(--step--1);
  font-weight: 700;
  vertical-align: 0.15em;
}
.owned {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--moss);
  padding: 10px 0;
}
@media (max-width: 480px) {
  .item,
  .item.has-image {
    grid-template-columns: minmax(0, 1fr);
  }
  .item-image {
    grid-row: auto;
  }
  .item-desc,
  .item.has-image .item-desc {
    grid-column: 1;
  }
  .item-buy {
    grid-row: auto;
    grid-column: 1;
    grid-template-columns: auto auto;
    justify-content: space-between;
    align-items: center;
    justify-items: start;
    margin-top: 8px;
  }
}

/* ---------------------------------------------------------------------------
   The receipt (cart, order confirmation, history)
--------------------------------------------------------------------------- */
.checkout {
  position: relative;
}
@media (min-width: 900px) {
  .checkout {
    position: sticky;
    top: 24px;
  }
}
.receipt {
  --tooth: 9px;
  position: relative;
  background: var(--receipt-bg);
  color: var(--receipt-ink);
  padding: 22px 22px 26px;
  border-radius: 3px 3px 0 0;
  filter: drop-shadow(0 1px 1px rgba(20, 35, 30, 0.18)) drop-shadow(0 8px 18px rgba(20, 35, 30, 0.1));
  margin-bottom: var(--tooth);
}
.receipt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--tooth) * -1);
  height: var(--tooth);
  background:
    linear-gradient(-45deg, transparent var(--tooth), var(--receipt-bg) 0) 0 0 / calc(var(--tooth) * 2) 100%,
    linear-gradient(45deg, transparent var(--tooth), var(--receipt-bg) 0) 0 0 / calc(var(--tooth) * 2) 100%;
  background-repeat: repeat-x;
}
.receipt a {
  color: #2c4c9c;
}
.receipt-head {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--receipt-rule);
}
.receipt-head h2 {
  font-size: var(--step-2);
  font-weight: 800;
  font-stretch: 80%;
}
.receipt-meta {
  font-size: var(--step--1);
  color: var(--receipt-soft);
}
.receipt-for {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 700;
}
.receipt-for img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  border-radius: 2px;
}
.receipt-for.is-empty {
  font-weight: 400;
  color: var(--receipt-soft);
}
.receipt-lines {
  list-style: none;
  margin: 0;
  padding: 14px 0;
  border-bottom: 2px dashed var(--receipt-rule);
  display: grid;
  gap: 10px;
}
.receipt-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: baseline;
}
.receipt-line .qty {
  color: var(--receipt-soft);
  font-variant-numeric: tabular-nums;
}
.receipt-line .amt {
  font-variant-numeric: tabular-nums;
}
.receipt-line .remove {
  grid-column: 1;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--receipt-soft);
  font-size: var(--step--1);
  text-decoration: underline;
  cursor: pointer;
}
.receipt-empty {
  color: var(--receipt-soft);
  text-align: center;
  padding: 8px 0;
}
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0 4px;
}
.receipt-total span {
  color: var(--receipt-soft);
}
.receipt-total strong {
  font-family: var(--display);
  font-size: var(--step-3);
  font-variant-numeric: tabular-nums;
}
.pay {
  margin-top: 16px;
  min-height: 48px;
}
.pay-note {
  font-size: var(--step--1);
  color: var(--receipt-soft);
  text-align: center;
  margin-top: 10px;
}
.pay-note.is-error {
  color: #a33a2c;
  font-weight: 700;
}
.receipt-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed var(--receipt-rule);
  font-size: var(--step--1);
  color: var(--receipt-soft);
  text-align: center;
  overflow-wrap: anywhere;
}

.stamp {
  position: absolute;
  top: 18px;
  right: 14px;
  transform: rotate(-10deg);
  padding: 2px 10px;
  border: 3px solid currentColor;
  border-radius: 4px;
  color: #2f6b45;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
  opacity: 0.8;
  pointer-events: none;
}
.stamp.is-problem {
  color: #a33a2c;
}
.signoff {
  margin-top: 12px;
  text-align: center;
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 650;
  line-height: 1.3;
}
.signoff span {
  font-family: var(--body);
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--receipt-soft);
}

/* Sale price + coupon bits inside the receipt (the receipt stays light in dark mode) */
.line-note {
  grid-column: 1 / -1;
  font-size: var(--step--1);
  color: var(--receipt-sale);
}
.coupon {
  padding: 12px 0;
  border-bottom: 2px dashed var(--receipt-rule);
  display: grid;
  gap: 6px;
}
.link-button {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: #2c4c9c;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.coupon-form {
  display: flex;
  gap: 8px;
}
.coupon-form input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 2px solid var(--receipt-rule);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--receipt-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.coupon-form input::placeholder {
  text-transform: none;
  letter-spacing: 0;
}
.coupon-form input:focus {
  border-color: #2c4c9c;
  outline: none;
}
.btn-small {
  min-height: 40px;
  padding: 0 0.9em;
}
.receipt .btn-quiet {
  color: #2f6b45;
  border-color: #2f6b45;
}
.receipt .btn-quiet:hover {
  background: #dcebe1;
}
.coupon-applied {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: baseline;
}
.coupon-applied strong {
  letter-spacing: 0.02em;
}
.coupon-applied #coupon-detail {
  color: var(--receipt-soft);
}
.coupon-applied .amt {
  color: #2f6b45;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.coupon-applied .remove {
  grid-column: 1;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--receipt-soft);
  font-size: var(--step--1);
  text-decoration: underline;
  cursor: pointer;
}
.coupon-error {
  font-size: var(--step--1);
  color: #a33a2c;
  font-weight: 700;
}
.receipt-sub {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  color: var(--receipt-soft);
  font-variant-numeric: tabular-nums;
}
.receipt-sub + .receipt-total {
  padding-top: 4px;
}
.btn-claim {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  font-size: var(--step-1);
  background: #2f6b45;
  border-color: #2f6b45;
  color: #ffffff;
}
.btn-claim:hover {
  background: #22533a;
  border-color: #22533a;
}
.pay[hidden] + .btn-claim {
  margin-top: 16px;
}

/* Mobile cart bar */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}
.cart-bar strong {
  font-family: var(--display);
  font-size: var(--step-1);
}
@media (min-width: 900px) {
  .cart-bar {
    display: none !important;
  }
}
@media (max-width: 899px) {
  body.has-cart-bar {
    padding-bottom: 76px;
  }
}

/* ---------------------------------------------------------------------------
   Order + history pages
--------------------------------------------------------------------------- */
.narrow {
  max-width: 640px;
}
.status-block {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 8px 0 32px;
}
.status-block img {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  border-radius: 4px;
}
.status-block h1 {
  font-size: var(--step-3);
  font-weight: 750;
}
.status-block p {
  color: var(--ink-soft);
  margin-top: 6px;
  max-width: 55ch;
}
.status-block.is-problem h1 {
  color: var(--danger);
}
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 2px solid var(--ink);
}
.history-list li {
  border-bottom: 1px solid var(--line);
}
.history-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  padding: 16px 4px;
  color: inherit;
  text-decoration: none;
}
.history-list a:hover {
  background: var(--moss-tint);
}
.history-list .when {
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.history-list .what {
  font-weight: 700;
}
.history-list .amount {
  grid-row: 1 / span 2;
  grid-column: 2;
  text-align: right;
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.history-list .state {
  display: block;
  font-family: var(--body);
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--ink-soft);
}
.prose {
  max-width: 68ch;
}
.prose h1 {
  font-size: var(--step-3);
  margin-bottom: 16px;
}
.prose h2 {
  font-size: var(--step-1);
  margin: 28px 0 8px;
}
.prose p,
.prose ul {
  margin: 0 0 12px;
}
.message {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--danger-tint);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
