/* Cart and checkout. Loaded on every page for the nav count; the rest only
   has anything to style on cart.html. Tokens come from styles.css. */

/* ---- the count in the nav ------------------------------------------- */

.nav__cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-200);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--marigold);
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.24s var(--ease-out), border-color 0.24s var(--ease-out), transform 0.24s var(--ease-out);
}

.nav__cart:hover,
.nav__cart:focus-visible {
  background: rgba(255, 207, 51, 0.12);
  border-color: var(--marigold);
}

.nav__cart:active { transform: translateY(1px); }

.nav__cart-n {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--magenta);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.nav__cart-n[hidden] { display: none; }

/* ---- page shell ------------------------------------------------------ */

.cart {
  padding-top: calc(var(--nav-h) + var(--s-500));
  padding-bottom: var(--s-800);
}

.cart__head { margin-bottom: var(--s-500); }

.cart__title {
  font-family: var(--display);
  font-size: clamp(40px, 8vw, 76px);
  line-height: 0.96;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--marigold);
  margin: 0 0 var(--s-100);
}

.cart__grid {
  display: grid;
  gap: var(--s-500);
  align-items: start;
}

@media (min-width: 900px) {
  .cart__grid { grid-template-columns: 1.25fr 1fr; gap: var(--s-700); }
  .cart__aside { position: sticky; top: calc(var(--nav-h) + var(--s-300)); }
}

.cart__panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 243, 179, 0.03);
  padding: var(--s-300);
}

.cart__h {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--marigold);
  margin: 0 0 var(--s-200);
}

/* ---- basket lines ---------------------------------------------------- */

.lines { list-style: none; margin: 0; padding: 0; }

.line {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  grid-template-areas:
    'shot text sum'
    'shot step step';
  gap: var(--s-100) var(--s-200);
  align-items: center;
  padding: var(--s-200) 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 560px) {
  .line {
    grid-template-columns: 60px 1fr auto auto;
    grid-template-areas: 'shot text step sum';
    gap: var(--s-300);
  }
}

.line:last-child { border-bottom: 0; }
.line--zero { opacity: 0.52; }

.line__shot { grid-area: shot; width: 60px; height: 80px; object-fit: contain; }
.line__text { grid-area: text; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.line__name {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
}

.line__name:hover { color: var(--marigold); }

.line__blurb { font-size: 13px; color: var(--ink-faint); }

.line__sum {
  grid-area: sum;
  font-family: var(--display);
  font-size: 18px;
  color: var(--marigold);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- stepper --------------------------------------------------------- */

.stepper {
  grid-area: step;
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  justify-self: start;
}

.stepper__btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--marigold);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}

.stepper__btn:hover:not(:disabled) { background: rgba(255, 207, 51, 0.16); }
.stepper__btn:active:not(:disabled) { transform: translateY(1px); }
.stepper__btn:disabled { opacity: 0.3; cursor: default; }

.stepper__n {
  min-width: 30px;
  text-align: center;
  font-family: var(--display);
  font-size: 18px;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

/* ---- totals ---------------------------------------------------------- */

.totals { margin: 0 0 var(--s-300); }

.totals__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-200);
  padding: var(--s-75) 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.totals__row span:last-child { font-variant-numeric: tabular-nums; }

.totals__row--total {
  margin-top: var(--s-75);
  padding-top: var(--s-200);
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--marigold);
}

/* ---- form ------------------------------------------------------------ */

.fields { display: grid; gap: var(--s-200); }

@media (min-width: 560px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .field--wide { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: var(--s-50); min-width: 0; }

.field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 10, 11, 0.55);
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;            /* 16px or iOS Safari zooms the page on focus */
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.field textarea { resize: vertical; min-height: 78px; }

.field input::placeholder,
.field textarea::placeholder { color: rgba(255, 243, 179, 0.34); }

.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  outline: none;
  border-color: var(--marigold);
  box-shadow: 0 0 0 3px rgba(255, 207, 51, 0.18);
}

.field input:user-invalid,
.field textarea:user-invalid { border-color: var(--chilli); }

.cart__pay { width: 100%; margin-top: var(--s-300); }
.cart__pay:disabled { opacity: 0.45; cursor: default; }

.cart__fine {
  margin: var(--s-200) 0 0;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

.cart__fine a { color: var(--marigold); }

/* ---- error, empty, done ---------------------------------------------- */

.cart__error {
  margin: 0 0 var(--s-300);
  padding: var(--s-200);
  border: 1px solid var(--chilli);
  border-radius: 10px;
  background: rgba(212, 63, 42, 0.12);
  color: var(--cream);
  font-size: 15px;
}

.cart__empty { text-align: center; padding: var(--s-600) var(--s-200); }

.cart__empty p { color: var(--ink-soft); margin: 0 0 var(--s-300); }

.cart__done { text-align: center; padding: var(--s-600) var(--s-200); }

.cart__done h1 {
  font-family: var(--display);
  font-size: clamp(34px, 7vw, 60px);
  text-transform: uppercase;
  color: var(--marigold);
  margin: 0 0 var(--s-200);
}

.cart__done p { color: var(--ink-soft); max-width: 46ch; margin: 0 auto var(--s-200); }

.cart__ref {
  display: inline-block;
  padding: var(--s-75) var(--s-200);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 14px;
  color: var(--cream);
}
