/* Product detail page (products#show) — HYB-452 Phase 5.
   Loaded only from products/show.html.erb via :extra_head, next to
   redesign/instant_truckload_quote.css. Tokens come from redesign/tokens.css.
   Layout direction is the feat/cce-redesign prototype (.r-pp__*), using the
   styles-v3 container values that actually rendered there. */

.r-pp { max-width: 1120px; margin: 0 auto; padding: 48px 64px 120px; }

.r-pp__back { margin-bottom: 24px; }
.r-pp__back-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 0;
  font-family: var(--r-body); font-size: 16px; font-weight: 600;
  color: var(--r-green); text-decoration: none;
}
.r-pp__back-link:hover { text-decoration: underline; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.r-pp__hero {
  display: grid; grid-template-columns: 0.95fr 1.1fr; gap: 56px;
  align-items: start;
  padding: 0 0 56px;
  border-bottom: 1px solid var(--r-line);
}
.r-pp__hero--text-only { grid-template-columns: 1fr; }
.r-pp__hero-media { position: relative; }
.r-pp__hero-img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r-radius-lg);
  border: 1px solid var(--r-line);
  background: var(--r-bg-alt);
}
.r-pp__attribution { position: absolute; bottom: 12px; right: 12px; }
.r-pp__attribution-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px;
  background: rgba(255,255,255,0.92); border: 1px solid var(--r-line);
  color: var(--r-ink-2); cursor: help;
}
.r-pp__attribution-card {
  display: none;
  position: absolute; bottom: 40px; right: 0; z-index: 10;
  width: 240px; padding: 10px 12px;
  background: var(--r-surface); border: 1px solid var(--r-line);
  border-radius: var(--r-radius); box-shadow: var(--r-shadow);
  font-size: 13px; line-height: 1.4; color: var(--r-ink-2);
}
.r-pp__attribution-card p { margin: 0; }
.r-pp__attribution:hover .r-pp__attribution-card,
.r-pp__attribution:focus-within .r-pp__attribution-card { display: block; }

.r-pp__hero-body { padding-top: 6px; }
.r-pp__title {
  margin: 14px 0;
  font-family: var(--r-display); font-weight: 600;
  font-size: clamp(36px, 4vw, 56px); line-height: 1; letter-spacing: -0.025em;
}
.r-pp__blurb { max-width: 620px; margin: 0; font-size: 18px; line-height: 1.55; color: var(--r-ink-2); }
.r-pp__blurb p { margin: 0 0 0.6em; }
.r-pp__more {
  background: transparent; border: 0; padding: 0; margin-left: 4px;
  font-family: var(--r-body); font-size: inherit; font-weight: 600;
  color: var(--r-green); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.r-pp__more:hover { color: var(--r-green-hover); }

.r-pp__hero-stats {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px;
  margin-top: 28px; padding: 20px;
  background: var(--r-surface); border: 1px solid var(--r-line);
  border-radius: var(--r-radius-lg);
}
.r-pp__hero-price {
  margin-top: 4px;
  font-family: var(--r-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; color: var(--r-ink); white-space: nowrap;
}
.r-pp__hero-price-sep { margin: 0 4px; color: var(--r-muted); font-weight: 500; }
.r-pp__hero-price-unit { margin-left: 2px; font-family: var(--r-body); font-size: 15.5px; font-weight: 400; color: var(--r-muted); }
.r-pp__hero-stat-v { margin-top: 4px; font-size: 17px; font-weight: 600; color: var(--r-ink); }
.r-pp__hero-stat-v--muted { color: var(--r-muted); }

/* ── Guide modal ──────────────────────────────────────────────────────── */
.r-pp__guide { position: fixed; inset: 0; z-index: 1000; }
.r-pp__guide[hidden] { display: none; }
.r-pp__guide-bg { position: absolute; inset: 0; background: rgba(20,19,15,0.55); }
.r-pp__guide-modal {
  position: absolute; inset: 24px 0 auto 0;
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px) 56px;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--r-bg); border-radius: var(--r-radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.r-pp__guide-modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin: 0 0 28px; padding: 24px 0 16px;
  background: var(--r-bg); border-bottom: 1px solid var(--r-line);
}
.r-pp__guide-modal-head .r-h3 { margin: 0; }
.r-pp__guide-reader { max-width: 68ch; color: var(--r-ink-2); font-size: 17px; line-height: 1.75; }
.r-pp__guide-reader p { margin: 0 0 1.15rem; }
.r-pp__guide-reader h2,
.r-pp__guide-reader h3 { margin: 2rem 0 0.75rem; font-family: var(--r-display); font-size: 22px; color: var(--r-ink); }
.r-pp__guide-reader ul,
.r-pp__guide-reader ol { margin: 0.5rem 0 1.4rem; padding-left: 1.4rem; }
.r-pp__guide-reader li { margin: 0.3rem 0; }
.r-pp__guide-reader p:has(> strong:only-child) { margin-top: 2rem; margin-bottom: 1rem; }
.r-pp__guide-reader a { color: var(--r-green); }
body.r-modal-open { overflow: hidden; }

/* ── Options header + packaging legend ────────────────────────────────── */
.r-pp__options { margin-top: 56px; }
.r-pp__options-head { margin-bottom: 24px; }
.r-pp__options-h {
  margin: 6px 0 8px;
  font-family: var(--r-display); font-size: 28px; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.1;
}
.r-pp__options-sub { max-width: 720px; margin: 0; font-size: 16px; line-height: 1.55; color: var(--r-muted); }
.r-pp__pkg-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 16px 0 0; padding: 0; }
.r-pp__pkg-legend > div { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.r-pp__pkg-legend dt { font-weight: 700; font-size: 15px; color: var(--r-ink); white-space: nowrap; }
.r-pp__pkg-legend dd { margin: 0; font-size: 14px; color: var(--r-ink-2); }

/* ── Sticky quantity bar ──────────────────────────────────────────────── */
.r-pp__qbar {
  position: sticky; top: 64px; z-index: 40;
  display: grid; grid-template-columns: minmax(220px, 340px) minmax(280px, 1fr); gap: 20px; align-items: center;
  margin-bottom: 18px; padding: 22px 24px;
  background: var(--r-surface); border: 1px solid var(--r-line);
  border-radius: var(--r-radius-lg); box-shadow: var(--r-shadow-sm);
}
.r-pp__qbar-label { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.r-pp__qbar-input {
  display: flex; align-items: center;
  height: 48px; padding: 0 14px;
  background: var(--r-surface); border: 1px solid var(--r-line-strong); border-radius: var(--r-radius);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.r-pp__qbar-input:focus-within { border-color: var(--r-green); box-shadow: 0 0 0 3px rgba(45,90,40,0.12); }
.r-pp__qbar-input input {
  width: 100%; min-width: 0;
  border: 0; outline: none; background: transparent;
  font-family: var(--r-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; color: var(--r-ink);
}
.r-pp__qbar-input span { margin-left: 8px; font-size: 15px; color: var(--r-muted); }
.r-pp__qbar-slider { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.r-pp__qbar-slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--r-muted); }
.r-pp__qbar-slider-head b { font-family: var(--r-mono); font-size: 16.5px; font-weight: 600; color: var(--r-ink); white-space: nowrap; }
.r-pp__qbar-note { margin: -4px 0 0; font-size: 14px; line-height: 1.35; color: var(--r-muted); }
.r-pp__qbar-note b { font-weight: 600; color: var(--r-ink-2); }
.r-pp__qbar-range { width: 100%; height: 28px; margin: 0; accent-color: var(--r-green); cursor: pointer; }
.r-pp__qbar-range:focus-visible { outline: 2px solid var(--r-green); outline-offset: 3px; }
.r-pp__qbar-scale { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; font-size: 13px; line-height: 1.2; color: var(--r-muted); }
.r-pp__qbar-scale span:nth-child(2) { text-align: center; }
.r-pp__qbar-scale span:last-child { text-align: right; }
.r-pp__qbar-step { display: flex; flex-wrap: wrap; gap: 6px; }
.r-pp__pill {
  appearance: none; cursor: pointer;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--r-line); border-radius: 999px; background: transparent;
  font-family: var(--r-body); font-size: 15px; color: var(--r-ink-2);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.r-pp__pill:hover { border-color: var(--r-ink-2); }
.r-pp__pill.is-active { background: var(--r-ink); border-color: var(--r-ink); color: #fff; }
.r-pp__pill:focus-visible { outline: 2px solid var(--r-green); outline-offset: 2px; }
.r-pp__qbar-truckload {
  grid-column: 1 / -1;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 12px 14px;
  background: var(--r-green-tint); border: 1px solid rgba(45,90,40,0.18); border-radius: var(--r-radius);
  font-size: 15.5px; color: var(--r-ink);
}
.r-pp__qbar-truckload svg { margin-right: 6px; color: var(--r-green); flex-shrink: 0; }
.r-pp__qbar-truckload-link { margin-left: 4px; font-weight: 600; color: var(--r-green); text-decoration: underline; }

/* ── Filters: packaging + variety chip rows ───────────────────────────── */
.r-pp__filters { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: flex-start; margin: 0 0 18px; }
.r-pp__filter { display: flex; flex-direction: column; gap: 6px; }
.r-pp__filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Matches line */
.r-pp__matches { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 22px; }

/* Empty / no-match panels */
.r-pp__empty {
  margin-bottom: 22px; padding: 44px 24px;
  background: var(--r-surface); border: 1px solid var(--r-line); border-radius: var(--r-radius-lg);
  text-align: center; color: var(--r-muted); font-size: 15.5px;
}
.r-pp__empty[hidden] { display: none; }
.r-pp__empty-inner { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; }
.r-pp__empty-inner p { margin: 0; max-width: 40ch; color: var(--r-ink-2); font-size: 15px; }
.r-pp__empty-inner .r-h3 { margin: 0; }

/* ── Variety / cultivar groups ────────────────────────────────────────── */
.r-pp__groups { display: flex; flex-direction: column; gap: 44px; }
.r-pp__variety { display: flex; flex-direction: column; gap: 14px; }
.r-pp__variety[hidden] { display: none; }
.r-pp__variety-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--r-line); }
.r-pp__variety-name { margin: 0; font-family: var(--r-display); font-size: 26px; font-weight: 600; letter-spacing: -0.015em; color: var(--r-ink); }
.r-pp__variety-count { font-size: 15px; font-weight: 500; color: var(--r-muted); }
.r-pp__variety-desc { max-width: 72ch; margin: 0 0 4px; font-size: 15.5px; line-height: 1.6; color: var(--r-ink-2); }
.r-pp__variety-desc p { margin: 0 0 0.6em; }
.r-pp__snippet[hidden] { display: none; }

/* One card per cultivar: name, blurb, then offers as divided rows. */
.r-pp__cultivar {
  display: flex; flex-direction: column;
  margin-top: 6px;
  background: var(--r-surface); border: 1px solid var(--r-line);
  border-radius: var(--r-radius-lg); overflow: hidden;
}
.r-pp__cultivar[hidden] { display: none; }
.r-pp__cultivar-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 0; }
.r-pp__cultivar-name { font-family: var(--r-body); font-weight: 600; font-size: 17px; color: var(--r-ink); }
.r-pp__cultivar-desc { max-width: 72ch; margin: 0; padding: 6px 20px 14px; font-size: 14.5px; line-height: 1.55; color: var(--r-muted); }
.r-pp__cultivar-desc p { margin: 0 0 0.5em; }
.r-pp__cultivar-head + .r-pp__offers { margin-top: 14px; }
.r-pp__offers { display: flex; flex-direction: column; }

/* ── Offer row ────────────────────────────────────────────────────────── */
.r-pp__offer {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.1fr) minmax(0, 0.9fr) auto;
  gap: 22px; align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--r-line);
  transition: background 120ms ease;
}
.r-pp__offer[hidden] { display: none; }
.r-pp__offer:hover { background: var(--r-bg-alt); }
.r-pp__offer.is-best { box-shadow: inset 3px 0 0 var(--r-green); }
.r-pp__offer.is-below-min { color: var(--r-muted); }
.r-pp__offer.is-below-min .r-pp__offer-pkg-label,
.r-pp__offer.is-below-min .r-pp__offer-ship b { color: var(--r-muted); }
.r-pp__offer-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.r-pp__offer-pkg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.r-pp__offer-pkg-label { font-family: var(--r-body); font-weight: 600; font-size: 16px; color: var(--r-ink); white-space: nowrap; }
.r-pp__offer-pkg .r-chip { height: 20px; font-size: 11.5px; }
.r-pp__badge--grower { background: #fef08a; border-color: #fde047; color: #713f12; }
.r-pp__offer-ship { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; color: var(--r-muted); }
.r-pp__offer-ship svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--r-muted); }
.r-pp__offer-ship b { font-weight: 600; color: var(--r-ink); white-space: nowrap; }
.r-pp__offer-admin { margin-left: 6px; font-size: 12px; color: var(--r-info); }
.r-pp__seedtest { margin-left: 10px; font-size: 14px; font-weight: 500; color: var(--r-info); text-decoration: underline; }
.r-pp__seedtest:hover { color: #1e3a8a; }
.r-pp__offer-diff { font-size: 13.5px; color: var(--r-muted); }
.r-pp__offer-diff[hidden] { display: none; }
.r-pp__offer-diff--best { color: var(--r-green); font-weight: 600; }

.r-pp__offer-pricecalc { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.r-pp__offer-pricecalc[hidden] { display: none; }
.r-pp__offer-units { font-weight: 500; color: var(--r-ink-2); }
.r-pp__offer-units .is-warn { color: var(--r-warn); }
.r-pp__offer-dot { margin: 0 2px; color: var(--r-line-strong); }
.r-pp__offer-unitprice { font-weight: 600; color: var(--r-ink); white-space: nowrap; }

.r-pp__offer-total { text-align: right; }
.r-pp__offer-total[hidden] { display: none; }
.r-pp__offer-total .r-eyebrow { font-size: 12px; }
.r-pp__offer-total-v { margin-top: 2px; font-family: var(--r-mono); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--r-ink); }
.r-pp__offer-freight { margin-top: 4px; font-size: 13px; line-height: 1.25; color: var(--r-muted); }

.r-pp__offer-action { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 140px; }
.r-pp__offer-action form { margin: 0; }
.r-pp__offer-action .r-btn.is-added { background: var(--r-green-hover); }
.r-pp__offer-error {
  max-width: 260px; margin: 0;
  font-size: 13.5px; line-height: 1.35; text-align: right; color: var(--r-alert);
}
.r-pp__offer-error[hidden] { display: none; }

/* Below-minimum state: the row stays visible so the customer sees what unlocks it. */
.r-pp__offer-min {
  grid-column: 2 / -1;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
  font-size: 14.5px; color: var(--r-warn);
}
.r-pp__offer-min[hidden] { display: none; }
.r-pp__offer-min .r-btn { height: 34px; padding: 0 12px; font-size: 14px; }

/* ── Cart toast ───────────────────────────────────────────────────────── */
.r-pp__toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 200;
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 340px; max-width: 440px; padding: 14px 16px;
  background: var(--r-surface); border: 1px solid var(--r-line);
  border-radius: var(--r-radius-lg); box-shadow: var(--r-shadow-lg);
  transform: translateY(16px); opacity: 0; pointer-events: none;
  transition: transform 220ms cubic-bezier(0.2,0.9,0.3,1.2), opacity 180ms ease;
}
.r-pp__toast.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.r-pp__toast-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--r-green); color: #fff;
}
.r-pp__toast-body { flex: 1; min-width: 0; }
.r-pp__toast-title { margin: 0 0 4px; font-family: var(--r-body); font-size: 16px; font-weight: 700; }
.r-pp__toast-details { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--r-ink-2); }
.r-pp__toast-warning { margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--r-warn); }
.r-pp__toast-warning[hidden] { display: none; }
.r-pp__toast-summary {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--r-line);
  font-size: 13.5px; color: var(--r-muted);
}
.r-pp__toast-summary[hidden] { display: none; }
.r-pp__toast-summary b { font-family: var(--r-mono); font-weight: 600; color: var(--r-ink); }
.r-pp__toast-actions { display: flex; gap: 8px; margin-top: 12px; }
.r-pp__toast-actions .r-btn { flex: 1; }
.r-pp__toast-x { padding: 0 4px; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--r-muted); cursor: pointer; }
.r-pp__toast-x:hover { color: var(--r-ink); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .r-pp { padding: 32px 28px 80px; }
  .r-pp__hero { grid-template-columns: 1fr; gap: 32px; }
  .r-pp__hero-stats { grid-template-columns: 1fr 1fr; gap: 16px; }
  .r-pp__guide-modal { inset: 12px 0 auto 0; width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
  .r-pp__guide-modal-head { flex-wrap: wrap; align-items: flex-start; }
  /* Two compact rows: package + origin beside the total, then the package
     count beside the button. Keeps each offer to about three lines. */
  .r-pp__offer {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main total" "calc action";
    gap: 8px 14px;
    padding: 12px 16px;
  }
  .r-pp__offer-main { grid-area: main; gap: 4px; }
  .r-pp__offer-pkg-label { font-size: 15.5px; }
  .r-pp__offer-ship { font-size: 14px; }
  .r-pp__offer-total { grid-area: total; text-align: right; }
  .r-pp__offer-total .r-eyebrow { display: none; }
  .r-pp__offer-total-v { margin-top: 0; font-size: 18px; }
  .r-pp__offer-freight { margin-top: 2px; font-size: 12px; }
  .r-pp__offer-pricecalc { grid-area: calc; align-self: center; font-size: 14px; }
  .r-pp__offer-action { grid-area: action; align-items: flex-end; min-width: 0; }
  .r-pp__offer-action .r-btn { height: 40px; padding: 0 14px; font-size: 15px; }
  .r-pp__offer-error { text-align: right; }
  .r-pp__offer-min { grid-area: calc / calc / action / action; grid-column: 1 / -1; justify-content: space-between; }
  .r-pp__cultivar-head { padding: 14px 16px 0; }
  .r-pp__cultivar-desc { padding: 4px 16px 12px; }
  .r-pp__cultivar-head + .r-pp__offers { margin-top: 10px; }
}
@media (max-width: 760px) {
  .r-pp { padding: 24px 16px 72px; }
  .r-pp__qbar { position: static; grid-template-columns: 1fr; padding: 18px 16px; }
  .r-pp__qbar-label { min-width: 0; }
  .r-pp__toast { left: 16px; right: 16px; bottom: 16px; min-width: 0; max-width: none; }
}
