/* THE PAD "/". Phone first.
   One card is the biggest thing on screen. The rest is stuck next to it, comes out of a slot, or is printed on the ground.
   Materials (stickers, tabs, paper, stamps, the card) come from base.css, card.css and parts.css. This file is layout and a few prints. */

.home {
  display: block;
  padding-top: 4px;
}

/* ── first screen: the gold card ────────────────────────────────────────────── */
.home__hero {
  position: relative;
  z-index: 2; /* a full card slides off over what lies under it */
  min-width: 0;
}
.home__gold {
  transform: rotate(-1.2deg);
}

/* ── under it on a phone, beside it on a desktop: address, buy sticker, totals ── */
.home__side {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'sku buy'
    'totals totals';
  align-items: start;
  gap: 18px 12px;
  min-width: 0;
  margin-top: 12px;
}
.home__skubox {
  grid-area: sku;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.home__sku {
  width: 100%;
  min-height: 44px;
}
.home__skuhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 10px;
  width: 100%;
}
.home__skutap {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.home__sku .barcode {
  width: 100%;
  font-size: 46px;
}
.home__fake {
  font-size: clamp(18px, 5.2vw, 24px);
  line-height: 1;
  text-wrap: balance;
}
.home__buy {
  grid-area: buy;
  --st-size: clamp(112px, 33vw, 148px);
  --rot: -8deg;
  margin: 0 4px 4px 0;
}

/* the running totals: the number is the big thing, the words follow it */
.home__totals {
  grid-area: totals;
  container-type: inline-size;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.home__total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5em;
  font-size: clamp(20px, 6vw, 30px);
  line-height: 1;
}
.home__total-n {
  font-size: 44px;
  font-size: min(15vw, 72px, calc(185cqw / var(--chars, 6)));
  line-height: 0.94;
}
.home__total-w {
  white-space: nowrap;
}

/* the tape exists from 900 px on */
.home__tape {
  display: none;
}

@media (min-width: 900px) {
  .home {
    padding-top: 8px;
  }
  .home__first {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(340px, 30vw, 460px);
    column-gap: clamp(24px, 3vw, 48px);
    align-items: stretch;
    min-height: min(calc(100vh - 184px), 780px);
  }
  .home__hero {
    align-self: center;
  }
  .home__gold {
    transform: rotate(-1.8deg);
  }
  .home__side {
    grid-template-rows: auto auto minmax(230px, 1fr);
    grid-template-areas:
      'totals totals'
      'sku buy'
      'tape tape';
    gap: 18px 14px;
    margin-top: 0;
    padding-top: 4px;
  }
  .home__totals {
    gap: 10px;
  }
  .home__total {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    font-size: clamp(22px, min(2.5vw, 4.2vh), 36px);
  }
  .home__total-n {
    font-size: 96px;
    font-size: min(124px, 13.4vh, calc(185cqw / var(--chars, 6)));
    line-height: 0.9;
  }
  .home__fake {
    font-size: clamp(18px, 1.7vw, 24px);
  }
  .home__buy {
    --st-size: 148px;
    align-self: center;
    margin: 0 6px 6px 0;
  }

  /* the tape: a slot in the backer, the pad's last drop on the head of the receipt, the roll under it */
  .home__tape {
    grid-area: tape;
    position: relative;
    display: block;
    align-self: stretch;
    min-width: 0;
    min-height: 230px;
    max-height: 480px;
    --tape-size: clamp(12px, 1vw, 14px);
  }
  .home__mouth {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    height: 14px;
    border-radius: 999px;
    background: #080808;
    box-shadow: 0 3px 0 rgba(255, 255, 255, 0.2);
  }
  .home__receipt {
    position: absolute;
    top: 7px;
    bottom: 0;
    left: 12px;
    right: 16px;
    display: flex;
    flex-direction: column;
  }
  .home__head {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1px 12px;
    width: 100%;
    padding: 15px 12px 8px;
    border-bottom: 1px dashed var(--print);
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0.02em;
    text-align: left;
    text-transform: none;
    color: var(--print);
    cursor: pointer;
  }
  .home__head:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--ink);
  }
  .home__head:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
  }
  .home__head-line {
    grid-column: 1 / -1;
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  .home__head-proof {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .home__paper {
    position: relative;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  /* a mask cuts a box-shadow off: the torn strip gets its hard shadow from a black twin behind it */
  .home__papershadow {
    position: absolute;
    inset: 0;
    padding: 0;
    background: var(--ink);
    transform: translate(3px, 3px);
  }
  .home__paper .tape {
    z-index: 1;
    flex: 0 1 auto;
    max-height: none;
  }
}
@media (min-width: 1180px) {
  .home__hero {
    --card-hero-land-max: 880px; /* the gold card may print larger here than anywhere else */
  }
}

/* ── the line above the rack ────────────────────────────────────────────────── */
.home__pitch {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 56px;
}
.home__pitchtext {
  flex: 1 1 auto;
  min-width: 0;
}
.home__pitch-a {
  display: block;
  color: var(--orange);
}
.home__launch {
  --rot: 8deg;
  margin: 6px 8px 10px 0;
}

/* ── THE RACK ───────────────────────────────────────────────────────────────── */
.home__rack {
  margin-top: 26px;
}
.home__rackhead {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* file tabs standing on the edge of a folder */
.home__tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  padding: 8px 6px 0 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-bottom: 5px solid var(--paper);
  box-shadow: 0 2px 0 var(--ink);
}
.home__tabs::-webkit-scrollbar {
  display: none;
}
/* the paste field, printed like a SKU label */
.home__paste {
  display: flex;
  width: 100%;
  max-width: 460px;
}
.home__paste .sku__label {
  cursor: pointer;
}
.home__paste-input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 2px 0 0;
  padding: 9px 10px 8px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--core);
  font-family: var(--f-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.home__paste-input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.home__paste-bars {
  width: 100%;
  height: 26px;
  font-size: 38px;
  line-height: 0.74;
}

.home__norack {
  margin: 24px 0 8px;
}
.home__racklist {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 14px -6px 0;
  padding: 0;
  list-style: none;
}
/* one place on the rack. content-visibility cuts at the edge of this box,
   so the padding is the room a crooked card needs: its turned corners, its focus ring. */
.home__slot {
  position: relative;
  min-width: 0;
  padding: 10px 6px 12px;
  content-visibility: auto;
  contain-intrinsic-block-size: auto 250px;
}
.home__slot > .card {
  margin-inline: auto;
}
/* a card that moves is bigger than its place for a moment */
.home__slot.is-slam,
.home__slot.is-dealt,
.home__slot.is-dropping {
  z-index: 3;
  content-visibility: visible;
}
.home__slot.is-slam {
  animation: home-slam 180ms cubic-bezier(0.7, 0, 1, 0.5) both;
}
.home__slot.is-dealt {
  animation: home-deal 150ms cubic-bezier(0.7, 0, 1, 0.5) both;
  animation-delay: calc(var(--i, 0) * 34ms);
}
@keyframes home-slam {
  from {
    transform: scale(1.3) rotate(-3deg);
  }
  to {
    transform: none;
  }
}
@keyframes home-deal {
  0% {
    transform: translate(12px, -24px) rotate(3deg) scale(1.08);
    visibility: hidden;
  }
  1% {
    visibility: visible;
  }
  100% {
    transform: none;
    visibility: visible;
  }
}
.home__more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  padding: 14px 0 6px;
}
.home__count {
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
}

@media (min-width: 640px) {
  .home__racklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home__slot {
    padding: 12px 10px 16px;
  }
}
@media (min-width: 900px) {
  .home__pitch {
    gap: 28px;
    margin-top: 72px;
  }
  .home__launch {
    margin-right: 24px;
  }
  .home__rackhead {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
  }
  .home__tabs {
    flex: 1 1 auto;
  }
  .home__paste {
    flex: 0 1 400px;
    margin-bottom: 6px;
  }
}
@media (min-width: 1100px) {
  .home__racklist {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* hung by hand: the three columns do not start on one line */
  .home__slot:nth-child(3n + 2) {
    margin-top: 18px;
  }
  .home__slot:nth-child(3n) {
    margin-top: 7px;
  }
}

/* ── THE PILE ───────────────────────────────────────────────────────────────── */
.home__pile {
  margin-top: 56px;
}
.home__pilelead {
  margin-bottom: 14px;
}

/* ── the back-of-pack print: a ruled box, lines only ────────────────────────── */
.home__pack {
  margin-top: 64px;
  border: 3px solid var(--cream);
  color: var(--cream);
}
.home__packline {
  padding: 14px 14px 11px;
  border-top: 2px solid var(--cream);
  font-size: clamp(24px, 6.4vw, 46px);
}
.home__packline:first-child {
  border-top: 0;
}
.home__packtrio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.home__packcell {
  padding: 12px 14px 10px;
  border-top: 2px solid var(--cream);
  font-size: clamp(19px, 5vw, 28px);
}
.home__packtrio--trust .home__packcell {
  padding: 11px 14px 10px;
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* the same broken ink as the lines printed around it */
  -webkit-mask-image: var(--tex-ink);
  mask-image: var(--tex-ink);
  -webkit-mask-size: 192px 192px;
  mask-size: 192px 192px;
}
.home__live {
  font-size: clamp(20px, 5.2vw, 34px);
}
.home__n {
  font-size: 1.7em;
  line-height: 0.9;
}
.home__feelink {
  display: inline-block;
  margin: -12px 0; /* a 44 px tap target that does not push the line apart */
  padding: 12px 0;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}
@media (min-width: 900px) {
  .home__pack {
    margin-top: 88px;
  }
  .home__packline,
  .home__packcell {
    padding-left: 22px;
    padding-right: 22px;
  }
  .home__packtrio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .home__packcell + .home__packcell {
    border-left: 2px solid var(--cream);
  }
}

/* ── the back of the gold card. Every measure is in em of the card's own back print, so it scales with the card. ── */
.home__connect {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.16em;
  cursor: pointer;
  touch-action: manipulation;
}
.home__back {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9em;
  padding-bottom: 0.8em;
}
.home__back p {
  margin: 0;
}
.home__rules {
  display: grid;
  gap: 0.34em;
}
.home__rules p {
  font-family: var(--f-display);
  font-size: 1.5em;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.home__bag {
  display: grid;
  gap: 0.2em;
  min-width: 0;
}
/* the bag ruler: a printed rule with ticks, an orange rider on it */
.home__ruler {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(var(--ink) 0 0) 0 50% / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 5%) 0 50% / 100% 14px no-repeat;
  cursor: ew-resize;
  touch-action: pan-y;
}
.home__ruler::-webkit-slider-runnable-track {
  height: 44px;
  background: transparent;
}
.home__ruler::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 34px;
  margin-top: 5px;
  border: 0;
  border-radius: 2px;
  background: var(--orange);
  box-shadow: inset 0 0 0 2px var(--ink), 2px 2px 0 var(--ink);
}
.home__ruler::-moz-range-track {
  height: 44px;
  background: transparent;
}
.home__ruler::-moz-range-thumb {
  box-sizing: border-box;
  width: 18px;
  height: 34px;
  border: 0;
  border-radius: 2px;
  background: var(--orange);
  box-shadow: inset 0 0 0 2px var(--ink), 2px 2px 0 var(--ink);
}
.home__ruler:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.home__odds,
.home__backtrust,
.home__bar-label {
  font-family: var(--f-mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.home__odds {
  font-size: 1em;
  line-height: 1.3;
}
.home__backtrust,
.home__bar-label {
  font-size: 0.86em;
  line-height: 1.5;
}
.home__bars {
  display: grid;
  gap: 0.6em;
  min-width: 0;
}
.home__bar {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.home__bar-label {
  display: block;
}
.home__bar .barcode {
  font-size: 3.2em;
}
/* the landscape gold card: the back is wide and short, so it is set in two columns */
@container slot (min-width: 720px) {
  .home__back {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    column-gap: 2em;
    align-items: start;
  }
  .home__rules {
    grid-row: span 2;
  }
  .home__backtrust {
    grid-column: 2;
    grid-row: 2;
  }
  .home__bars {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home__slot.is-slam,
  .home__slot.is-dealt {
    animation: none;
  }
}
