/* ============================================================
   COLLECTORS CERTIFIED GRADING — pages.css
   Styles for POP Report + Card Details (Phase 2 public pages).
   Builds on style.css tokens; reuses pf-* shell classes.
   ============================================================ */

/* ---------------- shared: big search bar ---------------- */
.pg-search {
  display: flex; gap: 10px; align-items: center;
  max-width: 720px; margin: 0 auto;
  background: rgba(6,16,25,.72);
  border: 1px solid rgba(54,212,249,.35);
  border-radius: 999px;
  padding: 6px 6px 6px 22px;
  box-shadow: 0 0 0 4px rgba(54,212,249,.06), 0 18px 50px rgba(0,0,0,.35);
}
/* .pg-search sets `display: flex`, which BEATS the [hidden] attribute - without
   this rule hiding the bar in JavaScript is a silent no-op. Every display-setting
   rule in this codebase needs its own [hidden] companion for the same reason. */
.pg-search[hidden] { display: none; }
.pg-search:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(54,212,249,.14); }
.pg-search svg { flex-shrink: 0; opacity: .7; }
.pg-search input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body);
  font-size: 16px; padding: 10px 0;
}
.pg-search input::placeholder { color: var(--dim); opacity: .8; }
.pg-search .btn { flex-shrink: 0; }

.pg-search-note {
  text-align: center; font-size: 12.5px; color: var(--dim);
  margin-top: 12px; letter-spacing: .3px;
}

/* ---------------- POP report ---------------- */
.pop-selected { margin-bottom: 22px; }
.pop-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.pop-card-head h2 {
  font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px);
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; line-height: 1.1;
}
.pop-card-type { font-size: 13px; color: var(--dim); letter-spacing: 1.2px; text-transform: uppercase; margin-top: 4px; }

.pop-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin-bottom: 20px;
}
.pop-stat {
  background: linear-gradient(170deg, rgba(166,196,224,.07), rgba(166,196,224,.02));
  border: 1px solid rgba(166,196,224,.15); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px;
}
.pop-stat-label { font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); }
.pop-stat-value { font-family: var(--font-mark); font-size: 30px; font-weight: 700; line-height: 1.15; }
.pop-stat-sub { font-size: 12.5px; color: var(--dim); font-weight: 600; }
.pop-stat.total .pop-stat-value { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pop-stat.g10 { border-color: rgba(54,212,249,.4); }
.pop-stat.g10 .pop-stat-value { color: var(--cyan); }
.pop-stat.g9 .pop-stat-value { color: #3DD68C; }
.pop-stat.g8 .pop-stat-value { color: #FFD166; }
.pop-stat.glow .pop-stat-value { color: #FF9A3D; }

/* chart + table side by side */
.pop-detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; align-items: stretch; }

.pop-chart-wrap { display: flex; flex-direction: column; }
.pop-chart {
  flex: 1; display: flex; align-items: flex-end; gap: 8px;
  height: 240px; padding: 12px 4px 0;
  border-bottom: 1px solid rgba(166,196,224,.2);
}
.pop-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.pop-bar-count { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pop-bar-fill {
  width: 100%; max-width: 46px; border-radius: 6px 6px 0 0;
  background: rgba(166,196,224,.25); min-height: 2px;
  transition: height .5s cubic-bezier(.2,.7,.3,1);
}
.pop-bar.g10 .pop-bar-fill { background: var(--grad); box-shadow: 0 0 18px rgba(54,212,249,.45); }
.pop-bar.g9 .pop-bar-fill { background: #3DD68C; }
.pop-bar.g8 .pop-bar-fill { background: #FFD166; }
.pop-bar.g7 .pop-bar-fill { background: #FF9A3D; }
.pop-bar.glo .pop-bar-fill { background: rgba(247,111,114,.75); }
.pop-bar-grade { font-size: 12px; color: var(--dim); font-weight: 600; padding-bottom: 8px; }
.pop-chart-caption { font-size: 12px; color: var(--dim); margin-top: 10px; }

.pop-grade-table td:first-child { color: var(--text); font-weight: 600; }
.pop-grade-table tr.total-row td {
  border-top: 1px solid rgba(166,196,224,.25); border-bottom: none;
  color: var(--text); font-weight: 700;
}

.pop-row-link { cursor: pointer; transition: background .15s; }
.pop-row-link:hover { background: rgba(54,212,249,.05); }
.pop-view-link { color: var(--cyan); font-weight: 600; font-size: 13px; white-space: nowrap; }

.pop-pc-note {
  margin-top: 18px; font-size: 12.5px; color: var(--dim);
  border-left: 3px solid rgba(54,212,249,.4); padding-left: 12px;
}

.pop-empty { text-align: center; color: var(--dim); padding: 40px 20px; }

/* ---------------- Card Details ---------------- */
.cd-grid {
  display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px;
  gap: 20px; align-items: start;
}

.cd-imgs { display: flex; flex-direction: column; gap: 20px; }
.cd-img-panel { padding: 18px; }
.cd-img-panel h3, .cd-panel h3 {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.cd-img-panel img { width: 100%; border-radius: 12px; }
.cd-img-placeholder {
  aspect-ratio: 720 / 1190; border-radius: 12px;
  background: linear-gradient(170deg, rgba(6,16,25,.9), rgba(22,39,53,.6));
  border: 1px dashed rgba(166,196,224,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--dim); font-size: 13px; text-align: center; padding: 20px;
}
.cd-img-placeholder img.cd-mark { width: 120px; opacity: .5; }

/* ---------------- D87: both photo sets as flip tiles ----------------
   Same mechanics as the collection page's slab tiles, restated locally so this
   page never has to pull collection.css in: the wrapper holds the perspective
   and the card's aspect ratio, the two faces stack absolutely and rotate
   together, and .is-flipped turns them over. Clicking anywhere in the tile (or
   Enter/Space while it is focused) does the flip. */
.cd-flip {
  display: block; perspective: 1400px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cd-flip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 12px; }
.cd-flip-3d {
  position: relative; aspect-ratio: 720 / 1190;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.35, .1, .2, 1);
}
.cd-flip.is-flipped .cd-flip-3d { transform: rotateY(180deg); }
.cd-flip-face {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.cd-flip-face-back { transform: rotateY(180deg); }
.cd-flip-face img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  border-radius: 12px; background: rgba(6, 16, 25, .6);
}
.cd-flip-face .cd-img-placeholder { height: 100%; aspect-ratio: auto; }
@media (prefers-reduced-motion: reduce) { .cd-flip-3d { transition: none; } }
.cd-flip-hint {
  margin-top: 10px; text-align: center; font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}

/* ---------------- D87: claim prompt (the slab QR lands here) ---------------- */
.cd-claim {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding: 16px 20px;
  border: 1px solid rgba(54, 212, 249, .32); border-radius: 16px;
  background: linear-gradient(180deg, rgba(54, 212, 249, .08), rgba(54, 212, 249, .02));
}
.cd-claim-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cd-claim-copy b { font-size: 15.5px; letter-spacing: .2px; }
.cd-claim-copy span { font-size: 13px; color: var(--muted); }
.cd-claim .btn { flex: none; }
.cd-claim.is-done {
  border-color: rgba(61, 214, 140, .35);
  background: linear-gradient(180deg, rgba(61, 214, 140, .09), rgba(61, 214, 140, .02));
}
.cd-claim-err { flex: 1 0 100%; margin: 0; font-size: 13px; color: #F76F72; }
@media (max-width: 560px) { .cd-claim, .cd-claim .btn { width: 100%; } }

.cd-panel { padding: 22px 24px; margin-bottom: 20px; }

.cd-info-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.cd-info-table th {
  text-align: left; font-weight: 500; color: var(--dim);
  padding: 9px 12px 9px 0; width: 42%;
  border-bottom: 1px dashed rgba(166,196,224,.1); vertical-align: top; white-space: nowrap;
}
/* D143: the VALUE column reads ALL CAPS, the way My Collection has always
   drawn a card title (.col-tile-title). A cert typed in as "yogi berra" read
   as a defect beside the caps headings around it. Display only — the record
   keeps the casing it was submitted with and no payload changes.
   This class serves the Card Information table AND Certification Details, so
   both align; neither holds an email or a url. The LABEL column (th) stays
   sentence case on purpose — caps labels against caps values gives the reader
   nothing to tell them apart, and th is white-space:nowrap at 42% width. */
.cd-info-table td {
  color: var(--text); font-weight: 600; padding: 9px 0;
  border-bottom: 1px dashed rgba(166,196,224,.1);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}
.cd-info-table tr:last-child th, .cd-info-table tr:last-child td { border-bottom: none; }
.cd-serial-note { font-size: 12.5px; color: var(--cyan); margin-top: 10px; line-height: 1.5; }
.cd-blurb { font-size: 14px; color: var(--muted); }

/* sub grades — four equal tiles; the total grade lives in the Grading Scale
   rail (the old fifth "Total Card Grade" tile floated loose at mid widths) */
.cd-subs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cd-sub {
  background: rgba(6,16,25,.5); border: 1px solid rgba(166,196,224,.12);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.cd-sub-name { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.cd-sub-grade { font-family: var(--font-mark); font-size: 30px; font-weight: 700; color: var(--cyan); line-height: 1.1; }
/* D143: the grade word ("Gem Mint") shouts here the way the same
   D.gradeLabel output already shouts in the Grading Scale rail
   (.cd-scale-meta span) — the two were reading differently. */
.cd-sub-label { font-size: 10.5px; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; }
/* KEPT although nothing renders it today: js/card-details.js stopped drawing
   the subgrade note (Jacob, 2026-08-30 — "for now"). The style stays so
   putting that one line back is all it takes. */
.cd-sub-note {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(166,196,224,.12);
  font-size: 12px; color: var(--muted); line-height: 1.45;
}

/* right rail */
.cd-scale-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0; border-bottom: 1px dashed rgba(166,196,224,.12);
}
.cd-scale-row:last-child { border-bottom: none; }
.cd-scale-num {
  font-family: var(--font-mark); font-size: 40px; font-weight: 700;
  color: var(--cyan); min-width: 64px; line-height: 1;
}
.cd-scale-num.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cd-scale-meta { display: flex; flex-direction: column; gap: 2px; }
.cd-scale-meta b { font-size: 14px; letter-spacing: .3px; }
.cd-scale-meta span { font-size: 12px; color: var(--dim); letter-spacing: .8px; text-transform: uppercase; }

.cd-dna {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 8px 14px; border-radius: 999px;
  background: rgba(61,214,140,.1); border: 1px solid rgba(61,214,140,.4);
  color: #3DD68C; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}

.cd-status-ok { color: #3DD68C; font-weight: 700; }
.cd-status-pc { color: #FFD166; font-weight: 700; }

/* CTA + ribbon */
.cd-cta { margin: 6px 0 26px; }
.cd-cta .btn { width: 100%; }
.cd-ribbon {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  border-top: 1px solid rgba(166,196,224,.12); padding-top: 22px;
}
.cd-ribbon-item { display: flex; gap: 12px; align-items: flex-start; }
.cd-ribbon-item svg { flex-shrink: 0; margin-top: 2px; }
.cd-ribbon-item b { display: block; font-size: 14px; color: var(--cyan); margin-bottom: 2px; }
.cd-ribbon-item span { font-size: 12.5px; color: var(--dim); }

/* PC banner */
.cd-pc-banner {
  background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.35);
  border-radius: 14px; padding: 16px 18px; font-size: 13.5px; color: var(--muted);
}
.cd-pc-banner b { color: #FFD166; }

/* not found / landing */
.cd-landing { max-width: 720px; margin: 0 auto; text-align: center; }
.cd-samples { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.cd-sample-tag {
  font-family: var(--font-mark); font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(6,16,25,.6); border: 1px solid rgba(166,196,224,.25);
  color: var(--muted); transition: border-color .2s, color .2s;
}
.cd-sample-tag:hover { border-color: var(--cyan); color: var(--cyan); }
/* D143: the sample tag's <small> is the PLAYER NAME — caps like every other
   card datum on this page. Display only. */
.cd-sample-tag small { color: var(--dim); font-family: var(--font-body); font-weight: 500; text-transform: uppercase; }

.cd-search-results { max-width: 720px; margin: 14px auto 0; text-align: left; }
.cd-search-results a {
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  padding: 11px 16px; border-radius: 12px; font-size: 14px; color: var(--muted);
  border: 1px solid transparent;
}
.cd-search-results a:hover { background: rgba(54,212,249,.06); border-color: rgba(54,212,249,.25); color: var(--text); }
.cd-search-results .cert-mono { font-family: var(--font-mark); font-size: 12.5px; color: var(--cyan); white-space: nowrap; }
/* D143: the CARD TITLE on a result row. Its own class rather than a positional
   selector so the "no cards match …" row, which quotes what the visitor typed,
   is not shouted back at them. */
.cd-res-title { text-transform: uppercase; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) {
  .cd-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .cd-rail { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .cd-rail .cd-panel { margin-bottom: 0; }
  .pop-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .pop-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .cd-grid { grid-template-columns: 1fr; }
  .cd-imgs { flex-direction: row; }
  .cd-imgs .cd-img-panel { flex: 1; }
  .cd-rail { grid-template-columns: 1fr; }
  .cd-subs { grid-template-columns: 1fr 1fr; }
  .pop-stats { grid-template-columns: 1fr 1fr; }
  .cd-ribbon { grid-template-columns: 1fr; }
  .pg-search { border-radius: 22px; flex-wrap: wrap; padding: 10px 14px; }
  .pg-search .btn { width: 100%; }
}
