/* BestDealSnag -- styles for the server-rendered catalog pages.
 *
 * layout.js has referenced /static/catalog.css since the server-rendered
 * pages were written, but the file never existed -- every such page has been
 * loading a 404 stylesheet and falling back to whatever site.css provided.
 * This supplies the missing pieces: product cards, and the product page.
 *
 * Tokens come from site.css; nothing is redefined here.
 */

/* ---------- product cards (used by layout.js productCard) ---------- */
.pc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pc-img { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pc-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pc-merchant { font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.pc-title { font-size: 0.92rem; font-weight: 700; line-height: 1.35; margin: 0; }
.pc-price { font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.pc-cta {
  margin-top: auto; text-align: center; padding: 10px 12px; border-radius: 9px;
  background: var(--snag); color: #fff; font-weight: 700; font-size: 0.88rem; text-decoration: none;
}
.pc-cta:hover { background: var(--snag-deep); }

/* ---------- product page ---------- */
.product { padding: 8px 0 48px; }

.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin: 8px 0 20px; }
.crumbs a { color: var(--plum); }

.p-top { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 32px; align-items: start; }

.p-media {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1;
}
.p-media img { max-width: 100%; max-height: 100%; object-fit: contain; }

.p-merchant { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.p-facts h1 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); line-height: 1.25; margin: 0 0 14px; }
.p-price { font-size: 2rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.p-brand { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 18px; }

/* The verdict is the reason the page exists, so it is the loudest element
   after the price -- not a footnote under the fold. */
.verdict { border-radius: 14px; padding: 16px 18px; margin: 18px 0; border: 1.5px solid var(--line); background: var(--card); }
.verdict-head { font-weight: 800; font-size: 1.02rem; margin-bottom: 6px; }
.verdict-detail { margin: 0 0 8px; font-size: 0.93rem; line-height: 1.55; color: var(--ink); }
.verdict-basis { margin: 0; font-size: 0.8rem; color: var(--ink-soft); }

.verdict-good { border-color: #1E8E5A; background: #F0FAF5; }
.verdict-good .verdict-head { color: #146340; }
.verdict-warn { border-color: #C9721A; background: #FFF6EC; }
.verdict-warn .verdict-head { color: #8A4B08; }
.verdict-neutral { border-color: var(--plum); background: var(--plum-soft); }
.verdict-neutral .verdict-head { color: var(--plum); }
.verdict-unknown { border-color: var(--line); background: var(--ground); }
.verdict-unknown .verdict-head { color: var(--ink-soft); }

/* The retailer's own discount claim, checked against what we saw. */
.claim { border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; border: 1px dashed var(--line); }
.claim-head { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.claim-body { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft); }
.claim-unsupported { border-color: #C0392B; background: #FDF1F0; }
.claim-unsupported .claim-head { color: #9A2B20; }
.claim-consistent { border-color: #1E8E5A; background: #F0FAF5; }
.claim-consistent .claim-head { color: #146340; }
.claim-unknown { border-color: var(--line); background: var(--ground); }

.p-cta {
  display: block; text-align: center; padding: 15px 20px; border-radius: 10px;
  background: var(--snag); color: #fff; font-weight: 800; font-size: 1rem;
  text-decoration: none; margin-bottom: 10px;
}
.p-cta:hover { background: var(--snag-deep); }
.p-track {
  display: block; width: 100%; padding: 13px 20px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 0.95rem; font-family: inherit; cursor: pointer;
}
.p-track:hover { border-color: var(--plum); color: var(--plum); }
.p-disclosure { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.5; margin: 12px 0 0; }

/* ---------- observed price history ---------- */
.p-history { margin-top: 44px; }
.p-history h2, .p-desc h2 { font-size: 1.15rem; margin: 0 0 12px; }

.ph-chart { margin: 0; color: var(--plum); }
.ph-chart svg {
  width: 100%; height: 160px; display: block;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
}
.ph-chart figcaption {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.8rem; color: var(--ink-soft); margin-top: 8px;
}
.ph-note { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.6; margin-top: 12px; }

.p-desc { margin-top: 36px; }
.p-desc p { font-size: 0.93rem; line-height: 1.65; color: var(--ink); }
.p-desc-note { font-size: 0.78rem; color: var(--ink-soft); margin-top: 8px; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .p-top { grid-template-columns: 1fr; gap: 20px; }
  .p-media { aspect-ratio: 4 / 3; padding: 14px; }
  .p-price { font-size: 1.6rem; }
}

@media (max-width: 600px) {
  /* Inputs under 16px make iOS Safari zoom the page on focus and push the
     field out of view mid-typing. See tools/mobile-check.mjs. */
  .track-card input[type=email] { font-size: 16px; }
  .ph-chart svg { height: 130px; }
}

/* ---------- product card grid + pagination ----------------------------------
   .pc-grid and .pager were referenced by /c/{slug} but never defined, so
   category pages were rendering their cards as an unstyled vertical stack.
   Defining them here fixes those pages as well as /reorder. */
.pc-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  margin: 20px 0 28px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 24px 0 8px;
  font-size: 0.95rem;
}
.pager a { color: var(--plum); font-weight: 600; }
.pager span { color: var(--ink-soft); }

/* ---------- "things that run out" ------------------------------------------
   The consumables section. Visually quieter than the deal pages on purpose:
   somebody replacing a toner cartridge is completing a chore, not browsing,
   so nothing here competes with the product cards for attention. */
.reorder-group {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 30px;
}
.reorder-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.reorder-head h2 { margin: 0; font-size: 1.25rem; }
.reorder-head h2 a { color: var(--ink); }
.reorder-count { color: var(--ink-soft); font-size: 0.88rem; margin: 0; }
.reorder-blurb { color: var(--ink-soft); margin: 8px 0 4px; max-width: 62ch; }
.reorder-more { margin: 0 0 4px; }
.reorder-more a { color: var(--plum); font-weight: 600; }

.reorder-filter { display: flex; gap: 8px; margin: 16px 0 10px; max-width: 460px; }
/* 16px minimum: below that, iOS Safari zooms the page on focus and hides the
   field the user just tapped. */
.reorder-filter input {
  flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.reorder-filter button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  padding: 10px 16px; background: var(--plum); color: #fff;
}

.note-plain {
  color: var(--ink-soft); font-size: 0.88rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; margin: 14px 0;
}

.reorder-others { border-top: 1px solid var(--line); margin-top: 34px; padding-top: 18px; }
.reorder-others h2 { font-size: 1.05rem; margin: 0 0 12px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chiprow a {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font-size: 0.9rem;
}

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

@media (max-width: 560px) {
  .pc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ---------- "runs out" hub, 33-category directory ---------------------------
   The hub stopped showing product cards when it grew past four groups: the
   page's job is to get someone into the right category in one click, and a
   scannable directory does that better than 132 thumbnails. */
.reorder-section { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 16px; }
.reorder-section h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--ink); }

.reorder-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 4px 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.reorder-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid #f2ede4;
}
.reorder-item a { color: var(--plum); font-weight: 600; }
/* Tabular figures so the counts line up down the column and can be compared
   at a glance rather than read one by one. */
.reorder-n {
  color: var(--ink); font-size: 0.85rem; font-variant-numeric: tabular-nums;
  margin-left: auto; white-space: nowrap;
}
.reorder-cadence {
  flex-basis: 100%; color: var(--ink-soft); font-size: 0.78rem; margin-top: -2px;
}

@media (max-width: 560px) {
  .reorder-list { grid-template-columns: 1fr; }
}

/* ---------- price-drop signup on category pages -----------------------------
   Lives on the CATEGORY page, not only the home page, because every realistic
   way of earning a first visitor sends them deep -- to a thread answering
   "cheapest TN760?", not to the front door. Without this a hard-won visitor is
   worth exactly one pageview. */
.reorder-signup {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 18px 20px; margin: 30px 0 10px;
}
.reorder-signup h2 { margin: 0 0 6px; font-size: 1.05rem; }
.reorder-signup p { margin: 0 0 12px; color: var(--ink-soft); font-size: 0.9rem; max-width: 60ch; }
.reorder-signup form { display: flex; gap: 8px; flex-wrap: wrap; max-width: 480px; }
/* 16px minimum or iOS Safari zooms on focus and hides the field. */
.reorder-signup input {
  flex: 1 1 210px; min-width: 0; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.reorder-signup button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  padding: 10px 18px; background: var(--plum); color: #fff; white-space: nowrap;
}
.reorder-signup button:disabled { opacity: .6; cursor: not-allowed; }
.rs-msg { margin: 10px 0 0 !important; font-size: 0.9rem; }
.rs-ok { color: var(--ok, #0a7d38); font-weight: 600; }
.rs-err { color: #b3261e; font-weight: 600; }

/* ---------- cost-per-page index ---------------------------------------------
   A table, deliberately. This is the one page whose value is the DATA rather
   than the links, so it is built to be read, quoted and screenshotted -- a
   forum will accept a number where it would remove a comparison page. */
.cpp-table { width: 100%; border-collapse: collapse; margin: 18px 0; background: var(--card); }
.cpp-table th, .cpp-table td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
.cpp-table th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); border-bottom: 2px solid var(--line);
}
/* Tabular figures so the per-page column reads as a ranked column of numbers
   rather than a list of strings. */
.cpp-table td.cpp-n, .cpp-table th.cpp-n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpp-table td:first-child { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpp-table td:nth-child(3), .cpp-table td:nth-child(4) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpp-table tbody tr:hover { background: #faf7f2; }
.cpp-pack { color: var(--ink-soft); font-size: 0.8rem; }

.cpp-controls { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; font-size: 0.9rem; }
.cpp-controls a { color: var(--plum); }
.cpp-controls a.on { color: var(--ink); font-weight: 700; text-decoration: underline; }

@media (max-width: 560px) {
  .cpp-table th, .cpp-table td { padding: 8px 7px; font-size: 0.85rem; }
}
