/* Full-bleed shell (ahg-4z16a). The card page is part of the /market page
   family: `body.mkt-body` (market.css) strips the global boxed `.container`
   + 32px body padding, the header is the shared `market/_header` chrome, and
   the shell inherits `.mkt-page`'s full 2000px width so the page fills the
   viewport like /market/:game/:set instead of sitting in a narrow column with
   the width wasted on either side. `.cd-page` just holds content -- the gutter
   belongs to `.mkt-page`. */
.cd-mkt-page .cd-page {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Individual item detail page (ahg-wt7u7). Scoped to .cd-page — follows
   DESIGN.md Vault Industrial tokens (--bg-secondary/--border-subtle/--radius-lg
   etc, defined globally in layouts/application.html.erb) rather than inventing
   new ones. Mobile-first hard minimums: 14px body, 44px tap targets. */

/* The breadcrumb now renders in the shared /market `.bar` / `.bar-title` /
   `.bar-up` (market.css) so it is visually identical to the set and game pages;
   the old `.cd-breadcrumb` / `.cd-crumb-*` / `.cd-title` rules were retired with
   that unification (ahg-4z16a). One tweak: give the bar a little air below it. */
.cd-page .bar { margin-bottom: 16px; }

.cd-subtitle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 20px;
}
.cd-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Change-version printing switcher (ahg-4i553). */
.cd-version-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cd-version-label {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.cd-version-select {
  max-width: 320px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  padding: 8px 30px 8px 12px;
  min-height: 40px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a8a29e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.cd-version-select:focus-visible { outline: 2px solid var(--accent-amber); outline-offset: 1px; }
@media (max-width: 560px) {
  .cd-version-select { max-width: 100%; min-height: 44px; }
}

/* Fact list beside the card art (Market price · You own · Finish). Replaces the
   old full-width boxed `.cd-stat-strip`, which stranded the price on the far
   left and the finish toggle on the far right with a lake of empty space
   between them. Here they are a compact label/value stack under the image. */
.cd-facts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.cd-fact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cd-fact-label {
  font-size: 14px;
  color: var(--text-muted);
}
.cd-fact-value {
  font-family: 'Geist Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}
/* "Preorder" is a word, not a number -- drop the mono/large numeric treatment
   so it doesn't masquerade as a price. */
.cd-fact-value--text {
  font-family: 'Geist', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}
/* Preorder context line under the stat strip: why the market price is blank. */
.cd-preorder-note {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 8px;
}

.cd-status-pill {
  display: inline-block;
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full, 999px);
  white-space: nowrap;
}
.cd-status-pill--success { background: var(--green-tint); color: var(--accent-green); }
.cd-status-pill--warning { background: var(--amber-tint); color: var(--accent-amber); }
.cd-status-pill--error   { background: var(--rose-tint);  color: var(--accent-rose); }
.cd-status-pill--neutral { background: var(--bg-card-hover); color: var(--text-secondary); }

/* Three flex columns on desktop -- card art + facts, price history, other
   printings -- so the page fills its width. Flex-wrap degrades it gracefully:
   the printings column wraps under the pair first, then everything stacks on a
   phone. `align-items: flex-start` keeps each column at its natural height. */
.cd-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.cd-col-img {
  flex: 0 0 300px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cd-col-chart { flex: 1 1 440px; min-width: 0; }
.cd-col-printings { flex: 1 1 360px; min-width: 0; }
/* Keep a long printings list from towering over the short art/chart columns --
   it scrolls within a bounded panel instead (its own header stays put). */
.cd-reprints-scroll { max-height: 620px; overflow-y: auto; }

@media (max-width: 900px) {
  /* Below the 3-column threshold: art + chart share a row, printings drops to
     full width beneath. On a phone the art column goes full width too. */
  .cd-col-img { flex-basis: 240px; max-width: 240px; }
  .cd-col-printings { flex-basis: 100%; }
  .cd-reprints-scroll { max-height: none; }
}
@media (max-width: 640px) {
  .cd-col-img { flex-basis: 100%; max-width: none; }
}

.cd-card-img {
  width: 100%;
  border-radius: var(--radius-lg);
  display: block;
}

.cd-no-img {
  width: 100%;
  aspect-ratio: 5 / 7;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.cd-set-line {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Secondary "View on TCGplayer" action (ahg-rb2rf): demoted below the card
   image now that the market page itself is the omnisearch destination. */
.cd-tcg-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
}

.cd-tcg-link:hover {
  color: var(--text-primary);
  border-color: var(--accent-amber);
}

/* "Copy prompt for your AI agent" button (ahg-26g3q) -- same secondary-action
   treatment as .cd-tcg-link (44px tap target, 14px text meet the DESIGN.md
   mobile-minimum floor). Label text swaps to "Copied!" on click (card_detail.js);
   no layout shift since both strings fit the same min-width. */
.cd-agent-prompt {
  margin: 8px 0 20px;
}

.cd-agent-prompt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.cd-agent-prompt-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-amber);
}

.cd-col-chart {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.cd-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.cd-no-history {
  font-size: 14px;
  color: var(--text-muted);
  padding: 24px 8px;
  text-align: center;
}

/* Link pattern: internal action (see DESIGN.md > Links). Same rule as
   dashboard.css.erb's .link-internal, duplicated here so this page doesn't
   need to load the dashboard stylesheet for one class. */
.cd-page .link-internal {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: border-color 100ms ease;
  cursor: pointer;
}
.cd-page .link-internal:hover {
  border-bottom-color: var(--text-secondary);
}

/* Recent sales comps (ahg-f1pn9): raw market_sales list + comp grade. */
.cd-recent-sales {
  margin-top: 24px;
}

/* Reprints table (ahg-hxlw4, replaces chip blobs). */
.cd-reprints {
  margin-top: 24px;
}

.cd-reprints-note {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cd-reprints-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}

.cd-reprints-table thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Col widths: icon | set name | year | price | badge */
.cd-reprints-table col:nth-child(1),
.cd-reprint-td-icon { width: 32px; }
.cd-reprint-td-year  { width: 52px; }
.cd-reprint-td-price { width: 88px; }
.cd-reprint-td-badge { width: 72px; text-align: right; }

.cd-printing-row td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.cd-printing-row:last-child td { border-bottom: none; }

.cd-printing-row--current td { background: var(--bg-glass); }

.cd-reprint-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.cd-reprint-icon--placeholder {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--bg-card-hover);
  border-radius: 3px;
}

.cd-reprint-link {
  color: var(--text-primary);
  text-decoration: none;
}
.cd-reprint-link:hover .cd-printing-row-set { text-decoration: underline; }

.cd-printing-row-set {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cd-reprint-td-year {
  font-family: 'Geist Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.cd-reprint-td-price {
  font-family: 'Geist Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.cd-reprint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-full, 999px);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.cd-reprint-badge--current {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.cd-reprint-badge--owned {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

/* Set-icon/release-date axis markers overlaid on the weekly chart SVG
   (card_detail.js). Additive-only: price_bucket_chart.js's own render never
   emits these elements. */
.cd-chart-marker-icon {
  pointer-events: none;
}

.cd-chart-marker-dot {
  fill: var(--text-muted);
  pointer-events: none;
}

/* Normal/Foil finish toggle (ahg-25j3e). Switches the chart's printing AND
   the header Market stat -- both server-rendered for both finishes up front,
   swapped client-side, no re-fetch on toggle. */
.cd-finish-toggle {
  display: flex;
  gap: 4px;
}

.cd-finish-btn {
  min-height: 44px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.cd-finish-btn--active {
  color: var(--text-primary);
  border-color: var(--accent-amber);
}

/* Holdings overlay (ahg-25j3e): the seller's own condition/finish rows for
   this product, never a page gate. */
.cd-holdings {
  margin-top: 24px;
}

/* ahg-z4fqa: bidirectional link back to the dashboard manage panel
   (reprice/watch/QR) for an owned SKU. */
.cd-manage-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-amber);
  text-decoration: none;
}

.cd-manage-link:hover {
  text-decoration: underline;
}

.cd-holdings-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}


.cd-holdings-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.cd-holdings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: 'Geist Mono', monospace;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .cd-holdings-table { font-size: 14px; }
  .cd-holdings-table th, .cd-holdings-table td { padding: 8px 4px; }
  .cd-holdings-table th:nth-child(1), .cd-holdings-table td:nth-child(1) { width: 22%; }
  .cd-holdings-table th:nth-child(2), .cd-holdings-table td:nth-child(2) { width: 16%; }
  .cd-holdings-table th:nth-child(3), .cd-holdings-table td:nth-child(3) { width: 12%; }
  .cd-holdings-table th:nth-child(4), .cd-holdings-table td:nth-child(4) { width: 24%; }
  .cd-holdings-table th:nth-child(5), .cd-holdings-table td:nth-child(5) { width: 26%; }
  .cd-status-pill { padding: 4px 8px; }

  /* Reprints table: the fixed icon/year/price/badge widths (32+52+88+72=244px)
     leave too little room for Set at this viewport, wrapping a name like
     "Portal Second Age" across 3 lines. Shrink the fixed columns so Set gets
     the room it needs for one line; badge stays put since "Viewing"/"Owned"
     already fit it tightly at the current size. */
  .cd-printing-row td { padding: 8px 6px; }
  .cd-reprints-table thead th { padding: 0 6px 8px; }
  .cd-reprints-table col:nth-child(1),
  .cd-reprint-td-icon { width: 24px; }
  .cd-reprint-td-year  { width: 38px; }
  .cd-reprint-td-price { width: 60px; }
}

/* One-sentence factual summary (ahg-99x5k) -- the exact same string embedded
   in the page's JSON-LD Product description, so the visible copy and the
   structured data can never drift apart. Sits between the breadcrumb/version
   row and the three-column body. */
.cd-summary {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 4px 0 16px;
}
