* { box-sizing: border-box; }

:root {
  --ink: #222;
  --muted: #555;
  --accent: #264653;
  --ok: #1f7a4d;
  --bad: #b3261e;
  --line: #ddd;
  --bg: #f5f5f5;
}

body {
  margin: 0;
  /* Disable double-tap-to-zoom so rapid taps are clicks; pinch zoom still works. */
  touch-action: manipulation;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent); }

/* ---- Header / footer ---- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px;
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.08em; color: var(--ink); text-decoration: none; }
.header-tools { display: flex; align-items: center; gap: 12px; }
.region { max-width: 11rem; font: inherit; font-size: 0.8125rem; padding: 4px; }
.cart-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
.badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}
.badge[hidden] { display: none; }

.site-footer { padding: 32px 16px; text-align: center; font-size: 0.8125rem; color: var(--muted); }

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  text-align: center;
}

h1 { margin: 0 0 8px; }
.description { margin: 0 0 24px; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; }

/* ---- Grid ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.grid-footer { margin-top: 8px; text-align: right; }

button { -webkit-user-select: none; user-select: none; }

.cell {
  padding: 0;
  border: 0;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: var(--line);
  -webkit-tap-highlight-color: transparent;
}
.cell:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cell:active { transform: scale(0.97); }
.cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---- Status + buttons ---- */

.status-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
  margin: 8px 0;
}
.status { margin: 0; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.taken { color: var(--bad); }

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.button {
  display: inline-block;
  padding: 12px 20px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button[hidden] { display: none; }
.button.secondary { background: transparent; color: var(--accent); }
.button[data-state="available"] { border-color: var(--ok); background: var(--ok); }
.button:disabled { border-color: #bbb; background: #ccc; color: #888; cursor: not-allowed; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.link span { text-decoration: underline; }
.link .icon {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }

/* ---- Product page ---- */

main.product {
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  text-align: left;
}
@media (min-width: 760px) {
  main.product { grid-template-columns: 1fr 1fr; align-items: start; }
}

.mockup { position: relative; margin: 0; aspect-ratio: 400 / 440; }
.mockup .shirt { width: 100%; height: 100%; display: block; }
/* 12" print on a ~20" wide shirt body: 37% of the mockup width, starting below the collar. */
.mockup .print { position: absolute; left: 31.5%; top: 19%; width: 37%; aspect-ratio: 1; }

.blank { color: var(--muted); }
.price { font-size: 1.125rem; font-weight: 600; }

.sizes { border: 0; padding: 0; margin: 16px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sizes legend { font-weight: 600; margin-bottom: 8px; }
.size input { position: absolute; opacity: 0; }
.size span {
  display: inline-block;
  min-width: 3em;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: #fff;
  text-align: center;
  cursor: pointer;
}
.size input:checked + span { border-color: var(--accent); font-weight: 700; }
.size input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.sizes:disabled .size span { cursor: default; opacity: 0.6; }

.added { margin-top: 8px; }
.added .actions { justify-content: flex-start; }
.back { margin-top: 24px; }

/* ---- Cart ---- */

main.cart { max-width: 640px; text-align: left; }
.items { list-style: none; padding: 0; margin: 16px 0; }
.item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  grid-template-areas: "img info price" "img info remove";
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.item > a { grid-area: img; }
.item img { display: block; width: 96px; height: 96px; }
.item .info { grid-area: info; display: flex; flex-direction: column; gap: 6px; }
.item .name { font-weight: 600; }
.item .price { grid-area: price; margin: 0; text-align: right; }
.item .link { grid-area: remove; justify-self: end; align-self: end; }
.timer { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); }
.timer.urgent { color: var(--bad); font-weight: 600; }

.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 16px 0 0; }
.totals dd { margin: 0; text-align: right; }
.totals .total { font-weight: 700; font-size: 1.125rem; }
.empty { margin: 24px 0; }

/* ---- Checkout ---- */

main.checkout {
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  text-align: left;
}
@media (min-width: 860px) {
  main.checkout { grid-template-columns: 2fr 3fr; align-items: start; }
  .summary { position: sticky; top: 16px; }
}
.checkout h2 { font-size: 1rem; margin: 24px 0 8px; }
.items.compact .item { grid-template-columns: 64px 1fr auto; grid-template-areas: "img info price"; align-items: center; }
.items.compact .item img { width: 64px; height: 64px; grid-area: img; }
.items.compact .item .info { gap: 2px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.875rem; margin: 20px 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.divider[hidden] { display: none; }
.legal { margin-top: 20px; }
.button.pay { width: 100%; margin-top: 8px; font-size: 1.0625rem; }
.field { display: block; margin: 12px 0 4px; font-size: 0.875rem; color: #30313d; }
.input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #e6e6e6;
  background: #fff;
  font: inherit;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 3px 6px rgba(0, 0, 0, 0.02);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(38, 70, 83, 0.25); }
.tracking { list-style: none; padding: 0; margin: 8px 0; }
.tracking li { padding: 4px 0; }
