/* Pizza Shop Coin Shop: the order is taken like at a pizzeria counter. The name on the order
   comes first, bundles are a stack of pizza boxes on the menu board, and payment sits on a
   kitchen ticket. Shared client markup and ids are unchanged; the client fills the stack. */

.coin-shop {
  --shop-card: var(--paper);
  --shop-accent: var(--tomato-deep);
  --shop-selected: var(--cheese-soft);
  --shop-radius: 14px;
  padding-block: clamp(1.6rem, 4vw, 2.8rem) clamp(3rem, 7vw, 4.5rem);
}

.shop-head {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.5rem);
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.shop-head img {
  flex: none;
  width: clamp(4rem, 9vw, 5.5rem);
  border-radius: 50%;
  border: 3px solid var(--espresso);
  background: #9fe0f2;
  box-shadow: 0 0 0 5px var(--cheese);
}

.shop-head .kicker {
  margin: 0;
}

.shop-head h1 {
  margin: 0.1rem 0 0.3rem;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  color: var(--tomato);
  text-shadow: 2px 2px 0 var(--espresso);
}

.shop-head p:last-child {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
}

.shop-noscript {
  padding: 1rem;
  border: 2px solid var(--espresso);
  border-radius: var(--shop-radius);
  background: var(--paper);
}

.step-no {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  margin-right: 0.4rem;
  border: 2px solid var(--espresso);
  border-radius: 50%;
  background: var(--tomato);
  color: #fff;
  font-family: var(--display);
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: 0.08em;
}

.order-name h2,
.menu-board legend,
.order-ticket h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.4rem);
  font-weight: 800;
  line-height: 1.25;
}

/* Layout: name strip across the top, menu board and kitchen ticket underneath. */
.order-counter {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  grid-template-areas:
    "name name"
    "board ticket";
  gap: clamp(1.1rem, 2.5vw, 1.75rem);
  align-items: start;
}

/* Step 1: the name on the order, written on a kraft label. */
.order-name {
  grid-area: name;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr);
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: clamp(1rem, 2.6vw, 1.4rem) clamp(1rem, 3vw, 1.8rem);
  border: 2px dashed rgba(43, 26, 17, 0.55);
  border-radius: var(--shop-radius);
  background: var(--kraft);
}

.order-name h2 {
  margin: 0;
}

.order-name .shop-fields {
  margin: 0;
}

.shop-fields label {
  color: var(--espresso);
}

.shop-fields input {
  min-height: 2.9rem;
  border: 2px solid var(--espresso);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

.shop-fields input:focus-visible {
  outline: 3px solid var(--tomato);
  outline-offset: 2px;
}

/* Step 2: chalkboard menu with the bundles stacked like pizza boxes. */
.coin-shop .menu-board {
  grid-area: board;
  padding: clamp(1.1rem, 3vw, 1.8rem);
  border: 10px solid var(--crust);
  border-radius: var(--shop-radius);
  background:
    radial-gradient(
      circle at 18% 12%,
      rgba(255, 255, 255, 0.07),
      transparent 45%
    ),
    var(--chalk);
  color: #f4efe6;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}

.coin-shop .menu-board legend {
  float: left;
  width: 100%;
  color: #fff;
}

.coin-shop .menu-board .step-no {
  background: var(--cheese);
  color: var(--espresso);
}

.coin-shop .shop-packages {
  clear: both;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 1.1rem;
  border-bottom: 8px solid var(--crust);
  border-radius: 0 0 4px 4px;
}

.coin-shop .shop-packages > p {
  margin: 0;
  align-self: stretch;
  color: rgba(244, 239, 230, 0.8);
}

.coin-shop .shop-package {
  width: 100%;
}

.coin-shop .shop-package:nth-child(1) {
  width: 68%;
}
.coin-shop .shop-package:nth-child(2) {
  width: 76%;
}
.coin-shop .shop-package:nth-child(3) {
  width: 84%;
}
.coin-shop .shop-package:nth-child(4) {
  width: 92%;
}

.coin-shop .shop-package > span {
  --disc: 1.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem 0.7rem;
  min-height: 3.9rem;
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  border: 2px solid var(--espresso);
  border-top-width: 7px;
  border-top-color: var(--tomato);
  border-radius: 8px;
  background: linear-gradient(180deg, #f3d6a6, var(--kraft));
  color: var(--espresso);
  box-shadow: 0 5px 0 #a8743f;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.coin-shop .shop-package:nth-child(2) > span {
  --disc: 2.15rem;
}
.coin-shop .shop-package:nth-child(3) > span {
  --disc: 2.4rem;
}
.coin-shop .shop-package:nth-child(4) > span {
  --disc: 2.65rem;
}
.coin-shop .shop-package:nth-child(n + 5) > span {
  --disc: 2.9rem;
}

/* A plain pizza disc that grows with each box; decoration only. */
.coin-shop .shop-package > span::before {
  content: "";
  flex: none;
  width: var(--disc);
  height: var(--disc);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #b8321f 0 11%, transparent 12%),
    radial-gradient(circle at 66% 44%, #b8321f 0 11%, transparent 12%),
    radial-gradient(circle at 44% 70%, #b8321f 0 11%, transparent 12%),
    radial-gradient(
      circle,
      var(--cheese-soft) 0 48%,
      var(--cheese) 62%,
      var(--crust) 66% 100%
    );
  border: 2px solid var(--espresso);
}

.coin-shop .shop-package strong {
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  line-height: 1;
}

.coin-shop .shop-package small {
  margin-right: auto;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.coin-shop .shop-package b {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 4.6rem;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--espresso);
  border-radius: 999px;
  background: var(--tomato);
  color: #fff;
  font-size: 1rem;
  line-height: 1.1;
}

.coin-shop .shop-package:hover > span {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #a8743f;
}

.coin-shop .shop-package input:checked + span {
  border-color: var(--espresso);
  border-top-color: var(--tomato);
  background: linear-gradient(180deg, #fff3cf, var(--cheese-soft));
  box-shadow:
    0 0 0 3px var(--cheese),
    0 5px 0 3px #a8743f;
}

.coin-shop .shop-package input:checked + span b {
  background: var(--espresso);
  color: var(--cheese-soft);
}

.coin-shop .shop-package input:focus-visible + span {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

/* Errors and "Try again" sit on the board, under the stack. */
.coin-shop .menu-board .shop-notice {
  margin-top: 1.1rem;
  border: 2px solid var(--espresso);
  background: var(--paper);
  color: var(--tomato-deep);
}

.coin-shop .shop-notice p {
  margin: 0;
  font-weight: 650;
}

.coin-shop .shop-reload {
  margin-top: 0.4rem;
  color: var(--espresso);
}

/* Step 3: kitchen ticket hanging from the rail. */
.order-ticket {
  grid-area: ticket;
  position: relative;
  margin-top: 14px;
  padding: clamp(1.4rem, 3vw, 1.8rem) clamp(1.1rem, 3vw, 1.6rem) 2rem;
  border: 2px solid var(--espresso);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--paper);
  filter: drop-shadow(6px 8px 0 rgba(43, 26, 17, 0.16));
}

.order-ticket::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: -16px;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(#d7dade, #8d9298);
  box-shadow: 0 2px 0 rgba(43, 26, 17, 0.3);
}

/* Torn bottom edge: paper teeth with a dark line under each tooth. */
.order-ticket::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -9px;
  height: 9px;
  background: conic-gradient(
      from -45deg at 50% 100%,
      var(--paper) 90deg,
      transparent 0
    )
    0 0 / 18px 9px repeat-x;
  filter: drop-shadow(0 2px 0 var(--espresso));
}

.coin-shop .order-ticket .shop-details {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  background: none;
}

.order-ticket .shop-details legend {
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.coin-shop .shop-methods {
  gap: 0.55rem;
}

.coin-shop .shop-methods span {
  padding: 0.55rem 0.95rem;
  border: 2px solid var(--espresso);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
}

.coin-shop .shop-methods input:checked + span {
  border-color: var(--espresso);
  background: var(--espresso);
  color: #fff;
}

.coin-shop .shop-methods input:focus-visible + span {
  outline-color: var(--tomato);
}

.ticket-lines {
  margin: 0 0 1.1rem;
  padding: 0.9rem 0 0;
  border-top: 2px dashed var(--line);
}

.ticket-lines div {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-block: 0.25rem;
}

.ticket-lines div::after {
  content: "";
  order: 1;
  flex: 1;
  min-width: 1rem;
  border-bottom: 2px dotted rgba(43, 26, 17, 0.35);
}

.ticket-lines dt {
  order: 0;
  color: var(--muted);
  font-weight: 650;
}

.ticket-lines dd {
  order: 2;
  margin: 0;
  font-weight: 750;
  text-align: right;
}

.ticket-lines .ticket-total dt,
.ticket-lines .ticket-total dd {
  color: var(--espresso);
  font-family: var(--display);
  font-size: 1.3rem;
}

.order-ticket .shop-submit {
  width: 100%;
  min-height: 3.3rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.order-ticket .shop-submit:disabled {
  background: #c9b7a6;
  color: rgba(43, 26, 17, 0.7);
  box-shadow: 0 3px 0 rgba(43, 26, 17, 0.35);
  transform: none;
  cursor: not-allowed;
}

.order-ticket .shop-terms {
  margin: 0.9rem 0 0;
}

.shop-support {
  color: var(--muted);
}

@media (max-width: 960px) {
  .order-counter {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "name"
      "board"
      "ticket";
  }
  .order-name {
    grid-template-columns: minmax(0, 1fr);
  }
  .order-name h2 {
    margin-bottom: 0.4rem;
  }
  .order-ticket {
    width: min(100%, 560px);
    justify-self: center;
  }
}

@media (max-width: 560px) {
  .coin-shop .shop-package:nth-child(1) {
    width: 84%;
  }
  .coin-shop .shop-package:nth-child(2) {
    width: 88%;
  }
  .coin-shop .shop-package:nth-child(3) {
    width: 92%;
  }
  .coin-shop .shop-package:nth-child(4) {
    width: 96%;
  }
  .coin-shop .menu-board {
    border-width: 7px;
  }
  .coin-shop .shop-package > span {
    gap: 0.3rem 0.5rem;
    padding-inline: 0.6rem 0.55rem;
  }
  .coin-shop .shop-package small {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
  }
  .coin-shop .shop-package b {
    min-width: 4.1rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 360px) {
  .coin-shop .shop-package > span {
    --disc: 1.6rem;
  }
  .coin-shop .shop-package:nth-child(n + 2) > span {
    --disc: 1.8rem;
  }
  .coin-shop .shop-package strong {
    font-size: 1.15rem;
  }
}
