/* FTR-012 Power-up locker (shop.js). Self-contained: it uses the site's variables from styles.css when present and the
   same values otherwise. The open locker is a navy twill patch with a gold merrow rim; each power-up is a black tape
   with a cream running stitch. Before $FTRG launches the locker is an unsewn pattern: a navy dashed outline on the
   orange ground with navy text (The Navy On Orange Rule). */

.shop {
  --s-navy: var(--navy, #1D2340);
  --s-gold: var(--gold, #D9A63E);
  --s-cherry: var(--cherry, #B3121E);
  --s-cream: var(--cream, #EFE4CC);
  --s-tape: var(--tape, #141414);
  --s-display: var(--display, "Bungee", "Arial Black", sans-serif);
  --s-text: var(--text, "Atkinson Next", "Atkinson Hyperlegible", system-ui, sans-serif);
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 24px;
  border-radius: 14px;
  background-color: var(--s-navy);
  background-image: url("img/twill.png");
  background-size: 24px 24px;
  color: var(--s-cream);
  font: 500 16px/1.45 var(--s-text);
  box-shadow: 0 4px 10px rgba(60, 14, 0, .3);
}
.shop__rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.shop__rim rect { fill: none; stroke: var(--s-gold); stroke-width: 9; stroke-dasharray: 1.6 1.1; }
.shop > :not(.shop__rim) { position: relative; }

.shop__title {
  margin: 0 0 8px;
  font: 400 20px/1.1 var(--s-display);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--s-cream);
}
.shop__explain, .shop__gate, .shop__quiet { margin: 0 0 16px; max-width: 60ch; font-size: 15px; font-weight: 600; }
.shop__explain { color: var(--s-cream); }
.shop__gate { color: var(--s-gold); }
.shop__quiet { margin: 0; color: var(--s-cream); opacity: .85; }

/* ---------- before launch: the unsewn pattern ---------- */
.shop--off {
  padding: 20px 20px 18px;
  background: transparent;
  border: 3px dashed var(--s-navy);
  box-shadow: none;
  color: var(--s-navy);
}
.shop--off .shop__title { color: var(--s-navy); margin-bottom: 4px; font-size: 18px; }
.shop--off .shop__quiet { color: var(--s-navy); opacity: 1; font-weight: 600; }
.shop--off .shop__status { color: var(--s-navy); }
.shop--off .shop__status:empty { display: none; }

/* ---------- item patches (black tapes) ---------- */
.shop__items {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px;
}
@media (min-width: 640px) { .shop__items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.shop__item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 14px; row-gap: 4px;
  align-content: start;
  padding: 16px 16px 16px 14px;
  border-radius: 8px;
  background: var(--s-tape);
  box-shadow: 0 3px 6px rgba(60, 14, 0, .3);
}
.shop__item::before {
  content: ""; position: absolute; inset: 5px; pointer-events: none;
  border: 2px dashed rgba(239, 228, 204, .45); border-radius: 6px;
}
.shop__item > * { position: relative; }
.shop__glyph { grid-row: 1 / span 3; width: 44px; height: 44px; margin-top: 2px; image-rendering: pixelated; }
.shop__name { margin: 0; font: 400 16px/1.2 var(--s-display); letter-spacing: .05em; color: var(--s-cream); }
.shop__does { margin: 0; font-size: 15px; line-height: 1.4; color: var(--s-cream); opacity: .9; }
.shop__price, .shop__owned { margin: 0; display: flex; align-items: baseline; gap: 6px; }
.shop__price { grid-column: 2; }
.shop__owned { grid-column: 2; }
.shop__num { font: 700 20px/1.2 var(--s-text); font-variant-numeric: tabular-nums lining-nums; color: var(--s-cream); }
.shop__unit { font: 700 13px/1.3 var(--s-text); letter-spacing: .06em; text-transform: uppercase; color: var(--s-gold); }

/* ---------- buttons ---------- */
.shop__burn, .shop__go {
  position: relative;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--s-cherry);
  color: var(--s-cream);
  font: 400 15px/1 var(--s-display);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .35);
  outline: 2px dashed rgba(239, 228, 204, .65);
  outline-offset: -7px;
  transition: transform 160ms cubic-bezier(.16, 1, .3, 1), box-shadow 160ms cubic-bezier(.16, 1, .3, 1);
}
.shop__burn { grid-column: 1 / -1; margin-top: 12px; width: 100%; }
.shop__burn:hover:not([disabled]), .shop__go:hover:not([disabled]) { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, .35); }
.shop__burn:active:not([disabled]), .shop__go:active:not([disabled]) { transform: translateY(1px); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.shop__burn:focus-visible, .shop__go:focus-visible { outline: 3px solid var(--s-gold); outline-offset: 3px; }
.shop__burn[disabled], .shop__go[disabled] { opacity: .6; cursor: progress; transform: none; }
@media (prefers-reduced-motion: reduce) { .shop__burn, .shop__go { transition: none; } }

.shop__use {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; min-height: 32px;
  font-weight: 700; font-size: 15px; color: var(--s-cream);
  cursor: pointer;
}
.shop__use input { width: 20px; height: 20px; margin: 0; accent-color: var(--s-cherry); cursor: pointer; }
.shop__use input:focus-visible { outline: 3px solid var(--s-gold); outline-offset: 3px; }

/* ---------- confirm step: sewn into the chosen patch, in place of its burn button ---------- */
.shop__confirm {
  grid-column: 1 / -1;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 2px dashed rgba(217, 166, 62, .8);
}
.shop__q { margin: 0 0 6px; font: 700 18px/1.35 var(--s-text); color: var(--s-cream); }
.shop__fine { margin: 0 0 14px; max-width: 62ch; font-size: 15px; line-height: 1.45; color: var(--s-cream); opacity: .9; }
.shop__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.shop__cancel {
  padding: 4px 2px; border: 0; background: none; cursor: pointer;
  font: 700 16px/1.2 var(--s-text); color: var(--s-cream);
  text-decoration: underline dashed 2px; text-underline-offset: 5px;
}
.shop__cancel:hover { text-decoration-style: solid; }
.shop__cancel:focus-visible { outline: 3px solid var(--s-gold); outline-offset: 3px; }
.shop__cancel[disabled] { opacity: .6; cursor: progress; }

/* ---------- status line ---------- */
.shop__status { margin: 16px 0 0; min-height: 1.45em; font-size: 15px; font-weight: 600; color: var(--s-cream); }
.shop__status:empty { margin-top: 0; min-height: 0; }
.shop__status--ok, .shop__status--error { padding-left: 12px; border-left: 3px dashed var(--s-gold); }
.shop__status--error { border-left-color: var(--s-cherry); border-left-style: solid; }
