/* The store pages: the app's look (src/theme.js palettes, the same values as web/share/public/style.css). Warm ivory
   on near-black, champagne gold as a sparing accent; ivory with deep gold in light mode (the phone's setting picks).
   System fonts; a serif for headings. Mobile first: a 2-column grid of cards, 3 from 768px, 4 from 1024px. */

:root {
  color-scheme: dark light;
  --bg: #0B0B0C;
  --surface: #16161A;
  --surface-raised: #1E1E23;
  --surface-high: #26252C;
  --border: #2A2830;
  --border-strong: #3A3740;
  --text: #F4EFE6;
  --text-muted: #A39E93;
  --text-faint: #968F85;
  --accent: #C9A96E;
  --accent-pressed: #B08D57;
  --accent-text: #C9A96E;
  --on-accent: #0B0B0C;
  --accent-soft: rgba(201, 169, 110, 0.12);
  --success-text: #4FAE86;
  --danger-text: #D6747A;
  --danger-soft: rgba(180, 71, 76, 0.16);
  --warning-text: #D19A3D;
  --warning-soft: rgba(209, 154, 61, 0.14);
  --skeleton: #212026;
  --shadow: none;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --gap: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F7F4EE;
    --surface: #FFFFFF;
    --surface-raised: #FBF9F5;
    --surface-high: #F1ECE3;
    --border: #E6E0D4;
    --border-strong: #D6CEBF;
    --text: #16161A;
    --text-muted: #6B665C;
    --text-faint: #726C62;
    --accent: #9C7A3C;
    --accent-pressed: #82652F;
    --accent-text: #82652F;
    --on-accent: #16161A;
    --accent-soft: rgba(156, 122, 60, 0.10);
    --success-text: #2B7454;
    --danger-text: #A33A3F;
    --danger-soft: rgba(163, 58, 63, 0.10);
    --warning-text: #8C631E;
    --warning-soft: rgba(183, 129, 42, 0.12);
    --skeleton: #ECE6DB;
    --shadow: 0 1px 2px rgba(22, 22, 26, 0.06), 0 4px 14px rgba(22, 22, 26, 0.05);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

[hidden] {
  display: none !important;
}

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

img {
  max-width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The frame: the header, the page, the footer */
.top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 6px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-text);
  text-decoration: none;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.foot {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 40px;
  text-align: center;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
}

.message {
  margin-top: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 18px 0 8px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
}

.panel > .subtitle:first-child {
  margin-top: 0;
}

.muted {
  margin: 4px 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.faint {
  margin: 4px 0;
  color: var(--text-faint);
  font-size: 13px;
}

.powered {
  font-family: var(--serif);
  letter-spacing: 0.06em;
}

/* The store's head: the logo or initials, the name, the seal, the blurb */
.store-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.store-logo {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
}

.store-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-text);
}

.store-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.seal {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.blurb {
  white-space: pre-line;
}

.stats {
  margin-top: 8px;
}

.show-list {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--text-muted);
}

.show-list li {
  margin: 4px 0;
}

/* The search box (with its Search button: a store too large for one page is searched on the server) and the game chips */
.search {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px keeps iPhone Safari from zooming in */
}

.search-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* A chip is a link (to /<handle>?game=) so it works without JavaScript; app.js answers it on the page when it can. */
.chip {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* The grid of cards */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

.item {
  min-width: 0;
}

.item-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.item-link:hover,
.item-link:focus-visible {
  border-color: var(--accent);
}

.item-photo {
  aspect-ratio: 5 / 7;
  background: var(--skeleton);
}

.item-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-placeholder,
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.item-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.item-detail {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.item-meta {
  margin: 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.item-cond {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.item-price {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-text);
  white-space: nowrap;
}

.item-qty {
  margin: 0;
  color: var(--text-faint);
  font-size: 11px;
}

.empty {
  text-align: center;
  padding: 36px 16px;
}

/* Previous / Page 2 of 3 / Next, for a store with more cards than one page holds */
.pages {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.pages a[rel="prev"] {
  justify-self: start;
}

.pages a[rel="next"] {
  justify-self: end;
}

.pages .faint {
  text-align: center;
}

/* The item page */
.crumb {
  font-size: 14px;
}

.banner {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning-text);
  font-weight: 600;
}

.banner[data-state="sold"],
.banner[data-state="gone"] {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.item-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-main {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--skeleton);
}

.photo-placeholder {
  aspect-ratio: 5 / 7;
  max-height: 420px;
  border: 1px solid var(--border-strong);
}

.thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 90px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--skeleton);
  overflow: hidden;
  cursor: pointer;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grade {
  margin: 10px 0 0;
  color: var(--text-muted);
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 12px 0 0;
}

.price {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--accent-text);
  white-space: nowrap;
}

.qty {
  color: var(--text-muted);
  font-size: 14px;
}

.badge {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
}

.verified-note {
  margin-top: 6px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.button:hover,
.button:active {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
}

.button.secondary {
  background: transparent;
  color: var(--accent-text);
  border-color: var(--border-strong);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

.buy {
  width: 100%;
  margin-top: 18px;
}

.panel-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.dealer-line {
  margin-top: 14px;
  font-size: 14px;
}

.back {
  margin-top: 10px;
}

/* "Report this item" (Part 5): a closed details panel under the card; the summary is the only thing shown until opened */
.report {
  padding: 0;
}

.report-summary {
  padding: 16px 18px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.report-summary::-webkit-details-marker {
  display: none;
}

.report-summary::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 10px 2px 0;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.report[open] > .report-summary::before {
  transform: rotate(45deg);
}

.report[open] > .report-summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.report-form,
.report > .notice,
.report > noscript {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 16px 18px 18px;
}

.report > .notice {
  margin: 0 18px 18px;
  padding: 10px 12px;
}

.report-form .muted {
  margin: 0;
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
.chip:focus-visible,
.thumb:focus-visible,
.report-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The order form (Part 4): stacked labelled fields, the shipping or pickup choice, the code step, the buttons */
.order-fields {
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px keeps iPhone Safari from zooming in */
}

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

.choice,
.field-group {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice legend,
.field-group legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--text-faint);
}

.radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.actions .button {
  width: 100%;
}

.funds-line {
  margin-top: 14px;
  font-weight: 600;
}

/* A sentence from the server or the form check: an error, a confirmation, or a plain note */
.notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 14px;
}

.notice.error {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.notice.ok {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* The order page: the status, the payment buttons, the card, the messages */
.order-head .title {
  font-size: 24px;
}

.pay-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 4px;
}

.pay-link {
  width: 100%;
}

.receive {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.msg-buyer {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: transparent;
}

.msg-dealer {
  align-self: flex-start;
}

.msg-meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--text-faint);
}

/* A message is text: its line breaks kept, long words wrapped, nothing clickable */
.msg-body {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.message-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* The standards */
.standards p {
  margin: 10px 0;
}

.standards ul,
.standards ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.standards li {
  margin: 6px 0;
}

/* The booth card (Part 8): black on white whatever the theme, so it prints as it shows. On screen one card at the
   proportions of a 4 x 6 inch card; in print a true 4 x 6 inch card, two side by side on letter paper, one on
   4 x 6 inch paper held upright (the second copy stays off there). The print rules below are scoped to the booth
   page (its <body> carries the class booth-page): every other page (a store, a card, the order form, a buyer's
   order page) prints as it shows, header and footer included. */
.booth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.booth-sheet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.booth-card {
  width: 100%;
  max-width: 384px;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px;
  background: #FFFFFF;
  color: #0B0B0C;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  text-align: center;
}

.booth-copy {
  display: none;
}

.booth-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  color: #0B0B0C;
}

.booth-seal {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9C7A3C;
}

.booth-qr {
  width: 72%;
  max-width: 260px;
  margin: 6px 0;
}

.booth-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.booth-address {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
  color: #0B0B0C;
}

.booth-scan {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  color: #0B0B0C;
}

.booth-powered {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B665C;
}

/* A quarter-inch margin on every printed page of the site (the booth card's 4 x 6 inch size counts on it). */
@page {
  margin: 0.25in;
}

@media print {
  body.booth-page {
    min-height: 0;
    padding: 0;
    background: #FFFFFF;
    color: #0B0B0C;
  }

  body.booth-page .top,
  body.booth-page .foot,
  .booth-controls {
    display: none !important;
  }

  body.booth-page .page {
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
  }

  .booth-sheet {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
  }

  .booth-card {
    flex: 0 1 4in;
    width: 4in;
    height: 6in;
    max-width: none;
    aspect-ratio: auto;
    padding: 0.3in 0.25in;
    border: 1px dashed #999999;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .booth-copy {
    display: flex;
  }
}

/* 4 x 6 inch paper held upright (narrower than 6.5 inches once the margins are off): one card fills the page (5.4 of
   the 5.5 inches left by the margins, so a printer's own margin cannot push it to a second page), no second copy.
   The same paper turned sideways is 5.5 by 3.5 inches inside the margins, too short for the card: the page's intro
   says to print it upright (portrait). */
@media print and (max-width: 6.5in) {
  .booth-copy {
    display: none;
  }

  .booth-card {
    flex-basis: auto;
    width: 100%;
    height: 5.4in;
    border: none;
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .item-page {
    flex-direction: row;
    align-items: flex-start;
  }

  .photos {
    flex: 1 1 55%;
    min-width: 0;
  }

  .item-info {
    flex: 1 1 45%;
    min-width: 0;
    position: sticky;
    top: 16px;
  }

  .title {
    font-size: 30px;
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
