/* v-shop: the post-counter world. Products are stamps, the cart is a parcel label,
   the receipt is postmarked. Airmail blue and red on cool airmail paper. */
@font-face {
  font-family: Archivo;
  src: url('/fonts/Archivo.woff2') format('woff2');
  font-weight: 400 900;
  font-stretch: 100% 125%;
  font-display: swap;
}

:root {
  --paper: #edf0f6;
  --sheet: #f8f9fc;
  --ink: #131b3a;
  --ink-2: #48506e;
  --rule: #c9cfdf;
  --blue: #1f45c2;
  --blue-deep: #16339a;
  --red: #c8302a;
  --red-wash: #fbeceb;
  --green: #1b6b4f;
  --radius: 4px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --stripes: repeating-linear-gradient(-45deg, var(--red) 0 14px, var(--sheet) 14px 22px, var(--blue) 22px 36px, var(--sheet) 36px 44px);

  font-family: Archivo, ui-sans-serif, system-ui, sans-serif;
  font-stretch: 100%;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--blue);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.price, .count, td, .total strong { font-variant-numeric: tabular-nums; }

/* Masthead with the airmail edge */
.masthead {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px) 18px;
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}
.masthead::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 6px;
  background: var(--stripes);
}
.brand {
  font-weight: 850; font-stretch: 125%; font-size: 1.6rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none; line-height: 1;
}
.tagline { margin: 0; color: var(--ink-2); font-size: .9rem; flex: 1; }
.cart-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 999px; padding: 7px 8px 7px 14px; cursor: pointer;
}
.cart-pill svg, .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.count {
  min-width: 1.75em; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--ink); color: var(--sheet); font-size: .8rem; font-weight: 700;
}
.count.bump { animation: bump .45s var(--ease); }
@keyframes bump { 30% { transform: scale(1.35); background: var(--red); } }

/* Layout */
main {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(24px, 3vw, 48px);
  max-width: 1280px; margin: 0 auto; padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 48px) 80px;
}
h1 {
  font-weight: 850; font-stretch: 112%; font-size: clamp(2rem, 4.2vw, 3.6rem);
  line-height: 1.02; letter-spacing: -0.035em; max-width: 16ch;
}
h1 span { color: var(--blue); }
.lede { margin: 14px 0 36px; color: var(--ink-2); font-size: 1.1rem; max-width: 52ch; }

/* The stamp sheet */
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 40px 28px; }
.stamp { display: flex; flex-direction: column; gap: 14px; }
.stamp-face {
  --hole: 5px; --step: 15px;
  padding: 11px; background: var(--sheet);
  -webkit-mask: radial-gradient(circle, #0000 var(--hole), #000 calc(var(--hole) + .5px)) calc(var(--step) / -2) calc(var(--step) / -2) / var(--step) var(--step) round,
    linear-gradient(#000 0 0) content-box;
  mask: radial-gradient(circle, #0000 var(--hole), #000 calc(var(--hole) + .5px)) calc(var(--step) / -2) calc(var(--step) / -2) / var(--step) var(--step) round,
    linear-gradient(#000 0 0) content-box;
  filter: drop-shadow(0 6px 10px rgb(19 27 58 / .10));
  transition: transform .5s var(--ease);
}
.stamp:hover .stamp-face { transform: rotate(-1.2deg) translateY(-3px); }
.plate {
  position: relative; aspect-ratio: 5 / 4; background: var(--tint); color: #fff;
  display: grid; place-items: center; overflow: hidden;
  outline: 1.5px solid rgb(255 255 255 / .55); outline-offset: -8px;
}
.plate img { width: 58%; height: auto; }
.denom {
  position: absolute; top: 14px; left: 16px;
  font-weight: 850; font-stretch: 118%; font-size: 1.7rem; line-height: 1; letter-spacing: -0.02em;
}
.denom small { font-size: .55em; vertical-align: .55em; margin-left: 1px; }
.country {
  position: absolute; bottom: 14px; right: 16px;
  font-size: .68rem; font-weight: 700; font-stretch: 125%; letter-spacing: .12em; text-transform: uppercase; opacity: .85;
}
.stamp.soldout .plate { filter: grayscale(1) contrast(.8); }
.stamp-info { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: start; padding: 0 2px; }
.stamp h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.stamp p { margin: 0; color: var(--ink-2); font-size: .92rem; grid-column: 1; }
.stamp .stock { grid-column: 1; font-size: .8rem; color: var(--ink-2); margin-top: 6px; }
.stamp .stock.low { color: var(--red); font-weight: 600; }
.stamp .add { grid-column: 2; grid-row: 1 / span 3; align-self: center; }

/* Buttons and fields */
button { font: inherit; cursor: pointer; }
.add, .ghost, .primary {
  border-radius: var(--radius); font-weight: 650; line-height: 1.2;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s;
}
.add { padding: 9px 14px; background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.add:hover:not(:disabled) { background: var(--ink); color: var(--sheet); }
.add:active:not(:disabled), .primary:active:not(:disabled) { transform: translateY(1px); }
.primary { width: 100%; padding: 13px 18px; border: 0; background: var(--blue); color: #fff; font-size: 1.02rem; }
.primary:hover:not(:disabled) { background: var(--blue-deep); }
.ghost { padding: 12px 16px; background: transparent; color: var(--ink); border: 1.5px solid var(--rule); }
.ghost:hover { border-color: var(--ink); }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary:disabled { background: var(--ink-2); }
.icon-btn { display: none; border: 0; background: transparent; color: var(--ink); padding: 6px; border-radius: var(--radius); }

label { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--ink); margin-bottom: 14px; min-width: 0; }
input {
  font: inherit; font-weight: 450; width: 100%; min-width: 0; padding: 11px 12px;
  border: 1.5px solid var(--rule); border-radius: var(--radius); color: var(--ink); background: #fff;
  font-variant-numeric: tabular-nums; caret-color: var(--blue);
}
input::placeholder { color: #6a7190; }
input:focus-visible { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(31 69 194 / .22); }
input[aria-invalid="true"] { border-color: var(--red); }

/* Cart: a parcel label */
#cart {
  align-self: start; position: sticky; top: 104px;
  background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 0 20px 20px; box-shadow: 0 10px 30px rgb(19 27 58 / .08);
}
#cart::before { content: ''; display: block; height: 10px; margin: 0 -20px 16px; background: var(--stripes); }
.label-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#cart h2 { font-size: 1.2rem; font-weight: 800; font-stretch: 112%; letter-spacing: -0.01em; }
#cart-lines { list-style: none; padding: 0; margin: 0; }
#cart-lines li {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px dashed var(--rule);
}
#cart-lines .thumb { grid-row: span 2; width: 40px; height: 40px; border-radius: 2px; background: var(--tint); display: grid; place-items: center; }
#cart-lines .thumb img { width: 28px; height: 28px; }
#cart-lines .name { font-weight: 600; font-size: .95rem; }
#cart-lines .price { font-weight: 600; }
#cart-lines .qty { grid-column: 2 / span 2; display: flex; align-items: center; gap: 2px; }
.qty button {
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border: 1.5px solid var(--rule); background: #fff; border-radius: var(--radius); color: var(--ink); font-weight: 700;
}
.qty button:hover:not(:disabled) { border-color: var(--ink); }
.qty output { min-width: 2.2em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
#cart-lines li.empty { display: block; color: var(--ink-2); border-bottom: 1px dashed var(--rule); padding: 18px 0; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 18px; font-weight: 600; }
.total strong { font-size: 1.5rem; font-weight: 850; font-stretch: 112%; letter-spacing: -0.02em; }

/* Mobile cart bar */
.cart-bar {
  position: fixed; z-index: 6; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 650;
  box-shadow: 0 10px 28px rgb(19 27 58 / .3);
}
.cart-bar strong { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Checkout notes */
.pay-note { margin: 10px 0 0; font-size: .85rem; color: var(--ink-2); }
.test-banner { margin: 0; padding: 8px 16px; text-align: center; font-size: .85rem; background: #e3e8f6; color: var(--ink-2); }
.test-banner strong { color: var(--ink); }
.slip .ship-to { margin: 0 0 16px; color: var(--ink-2); }
.dev-checkout { display: grid; place-items: center; min-height: 100vh; }
.testmode { margin: 0 0 18px; padding: 10px 12px; font-size: .85rem; color: var(--ink-2); background: #e3e8f6; border-radius: var(--radius); }
.testmode strong { color: var(--ink); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.actions { margin-top: 6px; }
.actions .primary { flex: 1.4; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } }

/* Receipt */
#receipt { max-width: 640px; margin: clamp(32px, 6vw, 72px) auto 80px; padding: 0 16px; }
.slip {
  position: relative; background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 28px clamp(20px, 4vw, 36px) 32px; box-shadow: 0 10px 30px rgb(19 27 58 / .08);
}
.slip::before { content: ''; display: block; height: 10px; margin: -28px calc(-1 * clamp(20px, 4vw, 36px)) 28px; background: var(--stripes); }
.slip h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: 12ch; }
.slip .meta { margin: 10px 0 24px; color: var(--ink-2); font-size: .92rem; }
.slip .meta code { font: inherit; font-weight: 600; color: var(--ink); word-break: break-all; }
.postmark { position: absolute; top: 34px; right: 26px; width: 128px; height: 128px; transform: rotate(-12deg); color: var(--blue); opacity: .9; }
.postmark.cancelled, .postmark.pending_payment { color: var(--red); }
.postmark text { font-family: Archivo, sans-serif; font-weight: 800; font-stretch: 120%; fill: currentColor; }
.slip table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.slip td { padding: 12px 0; border-bottom: 1px dashed var(--rule); }
.slip td:last-child { text-align: right; }
.slip tr.sum td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 850; font-stretch: 112%; font-size: 1.3rem; padding-top: 14px; }
.slip .paid-with { margin: 0 0 24px; }
.slip .primary { display: inline-block; width: auto; text-decoration: none; text-align: center; }

#toast {
  position: fixed; z-index: 7; bottom: 24px; left: 50%; translate: -50% 0;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .35s var(--ease); pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; padding-bottom: 120px; }
  .tagline { display: none; }
  .masthead { justify-content: space-between; }
  .sheet { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 32px 16px; }
  .stamp-info { grid-template-columns: 1fr; }
  .stamp .add { grid-column: 1; grid-row: auto; justify-self: stretch; margin-top: 10px; padding: 11px; }
  .denom { font-size: 1.35rem; top: 12px; left: 13px; }
  .country { display: none; }
  #cart {
    position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; top: auto;
    max-height: 85dvh; overflow: auto; border: 0; border-radius: 12px 12px 0 0;
    transform: translateY(105%); transition: transform .45s var(--ease); visibility: hidden;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    box-shadow: 0 -20px 50px rgb(19 27 58 / .25);
  }
  #cart::before { border-radius: 10px 10px 0 0; }
  body.cart-open #cart { transform: none; visibility: visible; }
  body.cart-open::after { content: ''; position: fixed; inset: 0; z-index: 7; background: rgb(19 27 58 / .45); }
  .icon-btn { display: inline-grid; }
  .postmark { width: 96px; height: 96px; top: 30px; right: 14px; }
  .slip h1 { max-width: 9ch; }
}
@media (min-width: 861px) { .cart-bar { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
