/* THE COIN PAGE  /c/<mint>
   One card is the biggest thing on screen. The rest is stuck to it, comes out of it, or is printed on the ground.
   The card, the tape, the pile, stickers, stamps and paper come from card.css, parts.css and base.css.
   This file places them, and prints the back of the card. */

.coinv {
  --coinv-w: 446px;        /* the card box: a portrait hero (430) with its edge and its shadow (16) */
  --coinv-tilt: -1.6deg;   /* the card hangs a little crooked */
  --coinv-buy: 96px;       /* the BUY sticker */
  --coinv-dip: 30px;       /* how far it comes down on the card: never onto the top print row */
  --coinv-out: 8px;        /* how far it sticks out past the right edge */
  --coinv-lift: 8px;       /* room for the corner that the tilt lifts */
  position: relative;
  display: block;
  min-width: 0;
}

/* ── first screen: the draw line, the card, the tape, the things under it ───── */
.coinv__stage {
  display: grid;
  grid-template-columns: minmax(0, var(--coinv-w));
  grid-template-areas:
    'head'
    'card'
    'tape'
    'under';
  justify-content: center;
}

/* printed on the ground above the card. The BUY sticker hangs in its right corner. */
.coinv__head {
  grid-area: head;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  min-height: calc(var(--coinv-buy) - var(--coinv-dip) + var(--coinv-lift));
  padding: 4px 2px 12px;
}
.coinv__head--buy {
  padding-right: calc(var(--coinv-buy) - var(--coinv-out) + 14px);
}
.coinv .coinv__draw {
  font-size: clamp(16px, 4.9vw, 24px);
  line-height: 1.06;
  letter-spacing: 0.02em;
}
.coinv__draw span {
  display: block;
}

.coinv__card {
  grid-area: card;
  position: relative;
  z-index: 2;
  min-width: 0;
  transform: rotate(var(--coinv-tilt));
}
.coinv .coinv__buy {
  --st-size: var(--coinv-buy);
  --rot: 9deg;
  position: absolute;
  z-index: 40;             /* on top of the card, also while a full card slides away under it */
  top: calc(var(--coinv-dip) - var(--coinv-buy));
  right: calc(var(--coinv-out) * -1);
}

/* the tape comes out from under the bottom edge of the card. About 6 lines of it show. */
.coinv__tape {
  --tape-size: clamp(10px, 2.8vw, 13px);   /* a trade line is about 47 characters: it must fit the strip */
  --tape-top: 38px;                        /* blank paper under the card and its shadow, before the first line */
  grid-area: tape;
  position: relative;
  z-index: 1;
  min-width: 0;
  margin: -30px 16px 0 0;
}
.coinv__tape-in {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(var(--tape-top) + 14px + 6 * (var(--tape-size) * 1.45 + 2px));
}
/* the hard shadow of the strip: the same torn shape in black, a step down and right. No filter on paper that prints. */
.coinv__tape-shadow {
  position: absolute;
  inset: 0;
  padding: 0;
  background: var(--ink);
  transform: translate(4px, 4px);
}
.coinv .coinv__tape .tape {
  position: relative;
  flex: 0 1 auto;
  padding-top: var(--tape-top);
  letter-spacing: 0;
}
/* under the card the strip is short and lies in the way of the thumb: it never takes the scroll from the page */
.coinv__tape .tape__window {
  overflow-y: hidden;
}

.coinv__under {
  grid-area: under;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 14px;
  min-width: 0;
  margin-top: 24px;
}
/* wallet state, written on strips of masking tape */
.coinv__bag {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  min-width: 0;
  padding: 0 4px 2px;
}
.coinv .coinv__strip {
  max-width: 100%;
  font-size: clamp(16px, 4.7vw, 21px);
  white-space: normal;
}
.coinv .coinv__sku {
  flex: 1 1 200px;
  transform: rotate(-1.2deg);
}
.coinv .coinv__sku:active {
  transform: rotate(-1.2deg) translate(2px, 2px);
}
.coinv .coinv__odds {
  --st-size: 92px;
  --rot: 7deg;
  margin-left: auto;
}

/* ── printed on the ground under the card ───────────────────────────────────── */
.coinv__ground {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin-top: 44px;
}
/* two short lines on a phone, one line where there is room: it breaks between them, never inside one */
.coinv__total span {
  display: inline-block;
  white-space: nowrap;
}
.coinv__pad {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 44px;
  margin: 0;
  font-family: var(--f-display);
  font-size: clamp(15px, 4.3vw, 22px);
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cream);
}
a.coinv__pad {
  color: var(--yellow);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.coinv__pile {
  margin-top: 14px;
}
.coinv__check {
  grid-area: under;
  margin-top: 26px;
}

/* a printed arrow: flat, in the ink of the line it sits in */
.coinv-arrow {
  display: inline-block;
  flex: none;
  width: 0.86em;
  height: 0.56em;
  background: currentColor;
  clip-path: polygon(0 36%, 58% 36%, 58% 0, 100% 50%, 58% 100%, 58% 64%, 0 64%);
}

/* NO SUCH CARD: one red stamp across a blank card */
.coinv-void {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.coinv-void .stamp {
  --rot: -8deg;
  font-size: 11cqw;
}

/* ── the back of the card ───────────────────────────────────────────────────── */
/* the signature panel = the wallet */
.coinv-sig {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12em 0.7em;
  min-width: 0;
}
.coinv-sig__who {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 0.5em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: none;
  color: rgba(17, 17, 17, 0.62);
}
.coinv-sig .sticker--tag {
  --st-h: 44px;
  --rot: -2deg;
  font-size: min(18.5px, 5.4cqw);
}
.coinv-sig .stamp {
  --rot: -3deg;
  font-size: 0.72em;
  white-space: normal;
}

.coinv .card__back {
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 17, 0.55) transparent;
}

.coinv-back {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.2em;
  padding: 0.1em 0.3em 1.6em 0;
  font-family: var(--f-mono);
  font-size: 3.6cqw;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--ink);
}

/* the rules: back-of-card print, 4 lines */
.coinv-back__rules {
  display: grid;
  gap: 0.16em;
}
.coinv-back__rules li {
  font-family: var(--f-display);
  font-size: 1.5em;
  line-height: 1.06;
  letter-spacing: 0.02em;
}

/* the bag ruler: a printed ruler with a slide-rule cursor */
.coinv-ruler {
  --ruler-h: 50px;
  --ruler-thumb: 32px;
  min-width: 0;
}
.coinv-ruler__scale {
  position: relative;
  height: var(--ruler-h);
  margin-right: 2px;
  border-radius: 2px;
  background-color: var(--paper);
  background-image: var(--tex-grain);
  box-shadow: inset 0 0 0 1.5px var(--ink), 2px 2px 0 var(--ink);
}
.coinv-ruler__ticks,
.coinv-ruler__marks {
  position: absolute;
  left: calc(var(--ruler-thumb) / 2);
  right: calc(var(--ruler-thumb) / 2);
  pointer-events: none;
}
.coinv-ruler__ticks {
  top: 1.5px;
  height: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.coinv-ruler__ticks i {
  flex: none;
  width: 1px;
  height: 7px;
  background: rgba(17, 17, 17, 0.6);
}
.coinv-ruler__ticks .is-mid {
  height: 13px;
  background: var(--ink);
}
.coinv-ruler__ticks .is-big {
  width: 2px;
  height: 20px;
  margin-inline: -0.5px;
  background: var(--ink);
}
.coinv-ruler__marks {
  bottom: 5px;
  height: 11px;
}
.coinv-ruler__marks span {
  position: absolute;
  bottom: 0;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translateX(-50%);
}
.coinv-ruler__input {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: ew-resize;
  touch-action: pan-y;
}
.coinv-ruler__input::-webkit-slider-runnable-track {
  height: var(--ruler-h);
  background: none;
}
.coinv-ruler__input::-moz-range-track {
  height: var(--ruler-h);
  background: none;
}
.coinv-ruler__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: var(--ruler-thumb);
  height: var(--ruler-h);
  border: 2px solid var(--ink);
  border-radius: 3px;
  background-color: rgba(255, 214, 10, 0.5);
  background-image: linear-gradient(90deg, transparent calc(50% - 1px), var(--red) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  box-shadow: 2px 2px 0 var(--ink);
}
.coinv-ruler__input::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--ruler-thumb);
  height: var(--ruler-h);
  border: 2px solid var(--ink);
  border-radius: 3px;
  background-color: rgba(255, 214, 10, 0.5);
  background-image: linear-gradient(90deg, transparent calc(50% - 1px), var(--red) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  box-shadow: 2px 2px 0 var(--ink);
}
.coinv-ruler__input:active::-webkit-slider-thumb {
  background-color: rgba(255, 90, 31, 0.5);
}
.coinv-ruler__input:active::-moz-range-thumb {
  background-color: rgba(255, 90, 31, 0.5);
}
.coinv-ruler__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.08em 0.36em;
  margin-top: 0.42em;
  font-family: var(--f-display);
  font-size: 1.9em;
  line-height: 1.08;
  letter-spacing: 0.012em;
}
.coinv-ruler__line b {
  font-weight: 400;
}
.coinv-ruler__line span {
  white-space: nowrap;
}
.coinv-ruler__line .coinv-ruler__odds {
  white-space: normal;
}
.coinv-ruler__line .coinv-arrow {
  color: var(--spot, var(--orange));
}

/* the facts, as a receipt table */
.coinv-back__facts {
  min-width: 0;
}
.coinv-facts {
  margin: 0;
}
.coinv-facts__row {
  display: flex;
  align-items: baseline;
  gap: 0.7em;
  min-height: 1.75em;
  border-bottom: 1px dashed rgba(17, 17, 17, 0.42);
}
.coinv-facts dt {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coinv-facts dd {
  flex: none;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.coinv-facts__link {
  position: relative;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-transform: none;
}
.coinv-facts__link::after {
  content: '';
  position: absolute;
  inset: -13px -10px;
}
.coinv-back__desc {
  display: -webkit-box;
  margin-top: 0.7em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 0.95em;
  line-height: 1.4;
  text-transform: none;
  overflow-wrap: anywhere;
}

.coinv-back__trust {
  display: grid;
  gap: 0.2em;
  padding-top: 0.7em;
  border-top: 2px solid var(--ink);
  font-size: 0.92em;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* barcodes made from the real addresses */
.coinv-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 1em 1.6em;
  min-width: 0;
}
.coinv-codes__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25em;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.coinv-codes .barcode {
  font-size: 3.2em;
}
.coinv-codes__cap {
  font-size: 0.86em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* the landscape card: the back is printed in three columns */
@container card (min-width: 600px) {
  .coinv-sig .sticker--tag {
    --st-h: 52px;
    font-size: 21.8px;
  }
  .coinv-back {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, 0.95fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      'rules ruler facts'
      'trust ruler facts'
      'codes codes codes';
    align-items: start;
    gap: 0.9em 1.4em;
    font-size: 1.9cqw;
  }
  .coinv-back__rules {
    grid-area: rules;
  }
  .coinv-back__rules li {
    font-size: 1.16em;
  }
  .coinv-ruler {
    grid-area: ruler;
  }
  .coinv-ruler__line {
    font-size: 1.36em;
  }
  .coinv-back__facts {
    grid-area: facts;
    font-size: 0.88em;
  }
  .coinv-back__trust {
    grid-area: trust;
    font-size: 0.8em;
  }
  .coinv-codes {
    grid-area: codes;
  }
}

/* ── wider than a phone: the card lies landscape ────────────────────────────── */
@media (min-width: 780px) {
  .coinv {
    --coinv-w: 816px;
    --coinv-tilt: -2deg;
    --coinv-buy: 112px;
    --coinv-dip: 12px;
    --coinv-lift: 18px;
  }
  .coinv .coinv__draw {
    font-size: 30px;
  }
  .coinv__tape {
    --tape-size: 13px;
    --tape-top: 48px;
    width: min(100% - 16px, 470px);
    margin-left: 7%;
  }
  .coinv .coinv__sku {
    flex: 0 1 440px;
  }
  .coinv .coinv__odds {
    --st-size: 104px;
  }
  .coinv .coinv__strip {
    font-size: 21px;
  }
}

/* ── desktop: the card centre-left, the tape beside it, stickers around it ──── */
@media (min-width: 1280px) {
  .coinv {
    --coinv-tilt: -3deg;
    --coinv-buy: 148px;
    --coinv-dip: 90px;
    --coinv-out: 112px;
    --coinv-lift: 26px;
  }
  .coinv__stage {
    grid-template-columns: minmax(736px, 816px) minmax(360px, 440px);
    grid-template-areas:
      'head head'
      'card tape'
      'under tape';
    column-gap: 56px;
  }
  .coinv__head--buy {
    padding-right: 2px;
  }
  .coinv .coinv__draw {
    max-width: 690px;
    font-size: 34px;
  }
  .coinv__draw span {
    display: inline;
  }
  /* the paper feeds out of a slot cut in the backer, and grows down the side of the card */
  .coinv__tape {
    --tape-size: clamp(11.5px, 0.93vw, 13.5px);
    width: auto;
    margin: 0;
  }
  .coinv__tape .tape__window {
    overflow-y: auto;
  }
  .coinv__tape::before {
    content: '';
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    height: 14px;
    border-radius: 999px;
    background: #080808;
    box-shadow: 0 3px 0 rgba(255, 255, 255, 0.2);
  }
  .coinv__tape-in {
    position: absolute;
    top: 76px;
    left: 10px;
    right: 14px;
    max-height: calc(100% - 76px);
  }
  .coinv .coinv__tape .tape {
    padding-top: 14px;
  }
  .coinv__under {
    margin-top: 30px;
  }
}
