/* ---------------------------------------------------------------------------
   Outsource China — product page (marketplace layout)

   Gallery | facts and variations | request-a-quote card, then a sticky tab bar
   and the detail sections. Builds on tokens.css, app.css and intel.css. The
   photo always sits on --photo-plate. No prices anywhere.
--------------------------------------------------------------------------- */

.pd { padding-bottom: var(--s-7); }

/* --- Breadcrumb -------------------------------------------------------------- */
.pd-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: var(--s-4) 0 var(--s-3); font-size: 12.5px; color: var(--text-subtle); }
.pd-crumb a { color: var(--text-muted); }
.pd-crumb a:hover { color: var(--accent); text-decoration: none; }
.pd-crumb [aria-current] { color: var(--text); font-weight: 600; }
.pd-crumb__back { margin-left: auto; font-weight: 700; color: var(--accent) !important; }

/* --- Top: gallery | info | quote ------------------------------------------------ */
.pd-top {
  display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr) 340px; gap: var(--s-5);
  align-items: start; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}

/* Gallery */
.pd-gallery { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s-3); min-width: 0; }
.pd-thumbs { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.pd-thumb {
  position: relative; display: grid; place-items: center; width: 68px; height: 68px; padding: 0; cursor: pointer; overflow: hidden;
  background: var(--photo-plate); border: 2px solid var(--border); border-radius: var(--radius);
}
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { border-color: var(--border-strong); }
.pd-thumb.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pd-thumb--video { background: var(--plate-1); color: var(--plate-text); }
.pd-thumb__play { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-contrast); font-size: 13px; padding-left: 2px; }
.pd-stage { position: relative; aspect-ratio: 1 / 1; background: var(--photo-plate); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: grid; place-items: center; }
.pd-stage img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.pd-stage video { width: 100%; height: 100%; background: #000; object-fit: contain; }
.pd-stage [hidden] { display: none; }
.pd-stage__badge { position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--plate-1); color: var(--plate-text); font: 700 11px/1.4 var(--mono); }
.pd-gallery__note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--text-subtle); }

/* Facts */
.pd-info { min-width: 0; display: grid; gap: var(--s-3); align-content: start; }
.pd-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pd-ref { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--signal); }
.pd-title { margin: 0; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.15; letter-spacing: -.02em; }
.pd-lede { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-muted); }
.pd-brand { margin: 0; font-size: 13px; color: var(--text-muted); }
.pd-keys { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--border); }
.pd-keys__row { display: grid; grid-template-columns: minmax(0, 140px) minmax(0, 1fr); gap: var(--s-3); padding: 7px 0; border-bottom: 1px solid var(--grid-line-strong); font-size: 13px; }
.pd-keys__row dt { color: var(--text-subtle); }
.pd-keys__row dd { margin: 0; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pd-keys__more { display: inline-block; padding: 8px 0 0; font-size: 12.5px; font-weight: 700; color: var(--accent); }

/* Variations */
.pd-vars { display: grid; gap: var(--s-3); padding: var(--s-3); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.pd-var__label { margin: 0 0 6px; font-size: 13px; color: var(--text-muted); }
.pd-var__label b { color: var(--text); }
.pd-var__label small { color: var(--text-subtle); }
.pd-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-swatch {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.pd-swatch--img { padding: 3px; flex-direction: column; gap: 3px; width: 72px; }
.pd-swatch--img img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--photo-plate); }
.pd-swatch--img span { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-swatch:hover { border-color: var(--text-muted); }
.pd-swatch.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.pd-certs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pd-certs li { padding: 3px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: 700 11.5px/1.5 var(--mono); }
.pd-certs a { color: var(--text); }
.pd-trust { display: grid; gap: 5px; margin: 0; padding: var(--s-3) 0 0; border-top: 1px solid var(--border); list-style: none; font-size: 12.5px; color: var(--text-muted); }
.pd-trust li { display: flex; gap: 8px; }
.pd-trust li::before { content: "✓"; flex: none; color: var(--success); font-weight: 700; }
.pd-trust b { color: var(--text); margin-right: 4px; }

/* Quote card */
.pd-quote { position: sticky; top: var(--sticky-top); display: grid; gap: 0; background: var(--surface); border: 1.5px solid var(--brand); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.pd-quote__head { padding: 12px 16px; background: var(--brand-subtle); border-bottom: 1px solid var(--border); }
.pd-quote__head h2 { margin: 0; font-size: 17px; }
.pd-quote__basis { display: block; margin-top: 2px; font: 600 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--warning); }
.pd-quote__form { display: grid; gap: var(--s-3); padding: var(--s-4); }
.pd-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.pd-field > label, .pd-field > legend, .pd-field--split > div > label { display: block; margin: 0 0 5px; padding: 0; font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.pd-field--split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.pd-field--split .pd-read { grid-column: 1 / -1; }
.pd-read { margin: 6px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.pd-read:empty { display: none; }
.pd-quote .tod__fw { display: inline-block; margin: 2px 2px 0 0; padding: 1px 5px; border-radius: 2px; font: 600 10.5px/1.5 var(--mono); }
.pd-quote .tod__fw--required { color: var(--warning); background: var(--warning-subtle); }
.pd-quote .tod__fw--common { border: 1px solid var(--border-strong); }
.pd-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pd-seg label { position: relative; margin: 0; cursor: pointer; }
.pd-seg input { position: absolute; opacity: 0; }
.pd-seg span { display: grid; padding: 7px 6px; text-align: center; border: 1.5px solid var(--border-strong); border-radius: var(--radius); }
.pd-seg b { font: 700 12.5px/1.2 var(--mono); }
.pd-seg small { font-size: 10.5px; color: var(--text-subtle); }
.pd-seg input:checked + span { border-color: var(--brand); background: var(--brand-subtle); }
.pd-seg input:focus-visible + span { box-shadow: var(--ring); }
.pd-check { display: flex; gap: var(--s-2); align-items: flex-start; margin: 0; padding: var(--s-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.pd-check input { width: auto; margin: 2px 0 0; accent-color: var(--brand); }
.pd-check b { display: block; font-size: 13px; }
.pd-check small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.pd-check:has(input:checked) { border-style: solid; border-color: var(--brand); background: var(--brand-subtle); }
.pd-quote__fine { margin: 0; text-align: center; font-size: 11.5px; color: var(--text-subtle); }
.pd-quote__aux { display: grid; gap: var(--s-2); padding: 0 var(--s-4) var(--s-4); }
.pd-quote__link { display: block; padding: 8px; text-align: center; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13px; font-weight: 600; color: var(--text); }
.pd-quote__link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pd-quote .wish--button .wish__btn { width: 100%; justify-content: center; }

/* --- Tabs + sections ---------------------------------------------------------- */
.pd-tabs {
  position: sticky; top: var(--mast-h); z-index: 5; display: flex; gap: 2px; margin: var(--s-5) 0 0; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 2px solid var(--border);
}
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-tabs a { flex: none; padding: 12px 18px; margin-bottom: -2px; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.pd-tabs a:hover { color: var(--text); text-decoration: none; }
.pd-tabs a.is-active { color: var(--brand-hover); border-bottom-color: var(--brand); }
.pd-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-5); align-items: start; margin-top: var(--s-4); }
.pd-sections { display: grid; gap: var(--s-4); min-width: 0; }
.pd-sec { padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); scroll-margin-top: calc(var(--mast-h) + 60px); }
.pd-sec h2 { margin: 0 0 var(--s-3); font-size: 18px; }
.pd-sub { margin: var(--s-5) 0 var(--s-3); font-size: 15px; }
.pd-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: 12.5px; color: var(--text-muted); }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pd-table th, .pd-table td { padding: 9px 12px; border-bottom: 1px solid var(--grid-line-strong); text-align: left; vertical-align: top; }
.pd-table tbody th { width: 34%; font-weight: 600; color: var(--text-muted); background: var(--surface-sunken); }
.pd-table thead th { font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }
.pd-table td .tag { margin-left: 8px; }
.pd-table__sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-subtle); }
.pd-table__cap { caption-side: top; padding: 0 0 8px; text-align: left; font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }
.pd-table--inco { margin-top: var(--s-3); }
.pd-table--inco tbody th { width: 70px; background: none; color: var(--text); }
.pd-table--inco tr.is-current > * { background: var(--brand-subtle); }
.pd-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-3); margin: var(--s-4) 0 0; }
.pd-meta dt { font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }
.pd-meta dd { margin: 3px 0 0; font-size: 13px; font-weight: 600; }
.pd-prose { font-size: 14.5px; line-height: 1.65; }
.pd-prose h3, .pd-prose h4 { margin: var(--s-4) 0 var(--s-2); font-size: 15px; }
.pd-matrix { margin-top: var(--s-3); }
.pd-matrix > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.pd-matrix[open] > summary { margin-bottom: var(--s-3); }

.pd-vargrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.pd-varcard { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.pd-varcard img, .pd-varcard__blank { display: grid; place-items: center; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--photo-plate); color: var(--text-subtle); font: 700 22px/1 var(--mono); }
.pd-varcard figcaption { display: grid; gap: 1px; padding: 8px 10px; font-size: 12.5px; }
.pd-varcard small { color: var(--text-subtle); font-size: 11px; }
.pd-varcard code { font-size: 11px; color: var(--text-subtle); }

.pd-paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.pd-path { position: relative; display: grid; gap: 6px; align-content: start; margin: 0; padding: var(--s-3); border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.pd-path input { position: absolute; opacity: 0; pointer-events: none; }
.pd-path__head { font-size: 14px; font-weight: 700; }
.pd-path__body { font-size: 13px; color: var(--text-muted); }
.pd-path__needs { font-size: 10px; color: var(--text-subtle); }
.pd-path:has(input:checked) { border-color: var(--brand); background: var(--brand-subtle); }
.pd-path:has(input:focus-visible) { box-shadow: var(--ring); }

/* Supply route (from the old blueprint, kept for the Incoterm read-out) */
.route { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 0 0 var(--s-3); padding: 0; list-style: none; }
.route__node { position: relative; display: grid; align-content: start; gap: 2px; padding: 26px 10px 10px 0; font-size: 12px; }
.route__node::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 1.5px; background: var(--border-strong); }
.route__node::after { content: ""; position: absolute; top: 4px; left: 0; width: 11px; height: 11px; background: var(--surface); border: 1.5px solid var(--signal); border-radius: 50%; }
.route__node:last-child::before { right: 50%; }
.route__n { font-size: 10.5px; font-weight: 700; color: var(--signal); }
.route__node strong { font-size: 12.5px; line-height: 1.25; }
.route__node small { color: var(--text-muted); line-height: 1.35; }
.route__handover { display: none; margin-top: 4px; padding: 2px 5px; justify-self: start; font: 700 10px/1.3 var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-contrast); background: var(--brand); }
.route__node.is-handover::after { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-subtle); }
.route__node.is-handover .route__handover { display: block; }
.pd-sec .gates { border: 1px solid var(--border); border-radius: var(--radius); }

.pd-side { position: sticky; top: calc(var(--mast-h) + 60px); }
.pd-card { padding: var(--s-4); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.pd-card .label-mono { margin: 0 0 var(--s-2); }
.pd-card ul { margin: 0 0 var(--s-3); padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; color: var(--text-muted); }
.pd-card b { color: var(--text); }

/* Phone bar */
.pd-bar { display: none; }

/* --- Responsive -------------------------------------------------------------- */
@media (max-width: 1240px) {
  .pd-top { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
  .pd-quote { grid-column: 1 / -1; position: static; }
  .pd-quote__form { grid-template-columns: 1fr 1fr; }
  .pd-quote__form > .btn, .pd-quote__form > .pd-quote__fine, .pd-quote__form > .pd-check { grid-column: 1 / -1; }
  .pd-body { grid-template-columns: 1fr; }
  .pd-side { position: static; }
}
@media (max-width: 900px) {
  .pd-top { grid-template-columns: 1fr; padding: var(--s-3); }
  .pd-gallery { grid-template-columns: 1fr; }
  .pd-thumbs { flex-direction: row; order: 2; max-height: none; overflow-x: auto; }
  .pd-stage { order: 1; }
  .pd-gallery__note { order: 3; }
  .pd-quote__form { grid-template-columns: 1fr; }
  .pd-paths { grid-template-columns: 1fr; }
  .route { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s-3); }
  .pd-crumb__back { margin-left: 0; width: 100%; }
  .pd-bar:not([hidden]) {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-pop);
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--plate-0); border-top: 1px solid var(--plate-line);
  }
  .pd-bar__ref { color: var(--plate-text-muted); }
}
@media (max-width: 600px) {
  .pd-keys__row { grid-template-columns: 1fr; gap: 2px; }
  .pd-field--split { grid-template-columns: 1fr; }
  .route { grid-template-columns: 1fr 1fr; }
  .pd-sec { padding: var(--s-4); }
}
@media print {
  .pd-quote, .pd-bar, .pd-tabs, .aihero--product, .pd-side { display: none !important; }
  .pd-top, .pd-body { grid-template-columns: 1fr; }
}
