/* Parts that more than one page uses: icons, drawings of the parts, thumbnails,
   shop marks, the product row, the offer strip, prices and status dots. Loaded
   after css/style.css (tokens), before the page's own stylesheet. The markup is
   made by js/art.js and js/ui.js. */

/* ---------- line icons ---------- */
.ico { display: inline-flex; flex: none; }
.ico svg { display: block; }

/* ---------- drawings of the parts ---------- */
/* Colours come from the --ill-* tokens only: fills .d dark, .m mid, .l light,
   .p pale, .a accent, .w warm, .g brass; strokes .sd .sm .sl .sp, and the
   patterned strokes .gc (gold contacts), .fin (heatsink fins), .hp (heat pipes),
   .vent. */
.art { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.art svg { display: block; overflow: visible; }
.art .d { fill: var(--ill-dark); }
.art .m { fill: var(--ill-mid); }
.art .l { fill: var(--ill-light); }
.art .p { fill: var(--ill-pale); }
.art .a { fill: var(--accent); }
.art .w { fill: var(--warm); }
.art .g { fill: var(--ill-brass); }
.art .sd, .art .sm, .art .sl, .art .sp, .art .gc, .art .fin, .art .hp, .art .vent { fill: none; }
.art .sd { stroke: var(--ill-dark); }
.art .sm { stroke: var(--ill-mid); }
.art .sl { stroke: var(--ill-light); }
.art .sp { stroke: var(--ill-pale); stroke-linecap: round; }
.art .gc { stroke: var(--ill-brass); stroke-dasharray: 1.3 .9; }
.art .fin { stroke: var(--ill-mid); stroke-dasharray: 1.4 2.2; }
.art .hp { stroke: var(--ill-mid); stroke-linecap: round; }
.art .vent { stroke: var(--ill-mid); stroke-dasharray: 2.2 1.8; }

/* ---------- thumbnails and part pictures ---------- */
/* .thumb is the small tile on --ill-pale; the drawing fills it, a real picture
   sits on it (multiply lets the white of a shop's photo take the tile's colour). */
.thumb {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-s);
  background: var(--ill-pale); color: var(--ill-mid); overflow: hidden;
}
.thumb > .art, .pic > .art { display: grid; place-items: center; width: 100%; height: 100%; }
.thumb > .art svg, .pic > .art svg { width: 84%; height: 84%; }
.thumb > .art .ico svg, .pic > .art .ico svg { width: auto; height: auto; }

/* partPicture(): fills its parent box. */
.pic { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.pic-img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
/* A large drawing leaves room for its "Ilustracija" caption; a photo has none. */
.pic-credit > .art svg { width: 82%; height: 82%; }
.pic-note { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; line-height: 1; color: var(--ink-3); }
@media (max-width: 720px) {
  .pic-credit > .art svg { width: 84%; height: 84%; }
  .pic-note { left: 7px; bottom: 6px; font-size: 10.5px; }
}

/* ---------- shop mark ---------- */
/* Initials in the shop's series colour (--sc, set by shopMark): a 14 % tint behind,
   the colour mixed with black for the letters. Sizes 20, 24, 32, 40, 56. */
.smark {
  --sc: var(--ink-3);
  flex: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 24px; height: 24px; border-radius: 6px; overflow: hidden; vertical-align: middle;
  background: color-mix(in srgb, var(--sc) 14%, white);
  color: color-mix(in srgb, var(--sc) 48%, black);
  font: 700 11px/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  text-decoration: none; white-space: nowrap; user-select: none;
}
/* doubled class so a container rule such as `.deal-ends span` cannot restyle the mark */
.smark.smark { display: inline-flex; margin: 0; padding: 0; text-align: center; }
.smark.smark-20 { width: 20px; height: 20px; border-radius: 5px; font-size: 9.5px; }
.smark.smark-24 { width: 24px; height: 24px; border-radius: 6px; font-size: 11px; }
.smark.smark-32 { width: 32px; height: 32px; border-radius: 6px; font-size: 14px; }
.smark.smark-40 { width: 40px; height: 40px; border-radius: 7px; font-size: 17px; }
.smark.smark-56 { width: 56px; height: 56px; border-radius: 8px; font-size: 23px; letter-spacing: -.03em; }
.smark-3.smark-20 { font-size: 8px; letter-spacing: -.04em; }
.smark-3.smark-24 { font-size: 9.5px; letter-spacing: -.04em; }
.smark-3.smark-32 { font-size: 12px; }
.smark-3.smark-40 { font-size: 14.5px; }
.smark-3.smark-56 { font-size: 20px; }
/* A logo (SHOP_PLATES in art.js): on white with a hairline by default; an opaque
   square logo fills the mark (.smark-fill, .smark-edge keeps the hairline for a
   white one); a light logo sits on its dark --plate. */
.smark.smark-logo { --plate: #fff; background: var(--plate); border: 1px solid var(--line); padding: 2px; }
.smark-logo.smark-32 { padding: 3px; }
.smark-logo.smark-40 { padding: 4px; }
.smark-logo.smark-56 { padding: 6px; }
.smark-logo.smark-plate { border-color: var(--plate); }
.smark-logo.smark-fill { border: 0; padding: 0; }
.smark-logo.smark-edge { padding: 0; }
.smark-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* the mark always comes with the shop's name as text */
.shop-at { display: inline-flex; align-items: center; gap: 8px; min-width: 0; vertical-align: middle; }
.shop-at > .smark-20 { margin-block: -2px; }

/* ---------- price ---------- */
/* priceTag(): the price in the display face with tabular figures. */
.price-tag { font: 700 26px/1 var(--font-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-tag-lg { font-size: 50px; letter-spacing: -.035em; }
.price-tag.good { color: var(--good); }
@media (max-width: 720px) { .price-tag-lg { font-size: 42px; } }

/* Payment discount: the price-list price struck through, and the condition. */
.list-was { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-was s { text-decoration-thickness: 1px; }
.pay-cond { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.pay-cond .pc-short { display: none; }
.pay-cond .pc-long { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 46ch; }
@media (max-width: 720px) {
  .pay-cond .pc-long { display: none; }
  .pay-cond .pc-short { display: inline; }
}

/* ---------- offer strip ---------- */
/* One dot per shop on a line from the lowest price (large, green) to the highest. */
.strip { position: relative; display: block; width: 104px; height: 12px; margin: 5px 0 1px; }
.strip::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 2px; background: var(--line); }
.strip i { position: absolute; top: 3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ink-3); box-shadow: 0 0 0 1.5px var(--surface); }
.strip i.lo { top: 1px; width: 10px; height: 10px; margin-left: -5px; background: var(--good); }
.strip i:first-child:not(.lo) { margin-left: -6px; }
.strip-lg { width: 100%; height: 16px; margin: 0; }
.strip-lg::before { top: 7px; }
.strip-lg i { top: 4px; width: 8px; height: 8px; margin-left: -4px; }
.strip-lg i.lo { top: 2px; width: 12px; height: 12px; margin-left: -6px; }
/* the large strip with its end prices, on a tinted panel (product page price box) */
.buy-range { margin-top: 18px; padding: 12px 14px 10px; border-radius: var(--r-m); background: var(--tint); }
.buy-range-ends { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.buy-range-ends span:first-child { color: var(--good); }

/* ---------- status dot ---------- */
/* Status is a coloured dot with text, never a pill. */
.bstatus { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.bstatus::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bstatus.ok { color: var(--good); }
.bstatus.bad { color: var(--bad); }
.bstatus.unknown { color: var(--warn); }
.bstatus.none { color: var(--ink-3); font-weight: 500; }
.bstatus.none::before { display: none; }

/* ---------- product row ---------- */
/* Rows divided by hairlines, no boxes; the whole row opens the part through the
   name's ::after. */
.rows { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-2); }
.row {
  position: relative; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto auto;
  grid-template-areas: "thumb info price action"; gap: 6px 22px; align-items: center; padding: 18px 12px;
  border-bottom: 1px solid var(--line); transition: background-color .15s;
}
.row:hover { background: var(--tint); }
.row .thumb { grid-area: thumb; width: 88px; height: 88px; }
.row-info { grid-area: info; min-width: 0; }
.row-brand { margin-bottom: 4px; font: 500 13px/1.3 var(--font-body); color: var(--ink-3); }
.row-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 600; font-size: 16px; line-height: 1.35; color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
.row-name::after { content: ""; position: absolute; inset: 0; }
.row-name:hover { color: var(--accent); }
/* the focus ring goes round the whole row, which is what the link opens */
.row-name:focus-visible { outline: none; }
.row-name:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-specs { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.row-compat { margin-top: 8px; font-size: 13px; }
.row-compat .bstatus { font-weight: 550; }

.row-price { grid-area: price; min-width: 150px; display: grid; justify-items: end; gap: 3px; text-align: right; }
.row-price .from { font-size: 12.5px; color: var(--ink-3); }
.row-price small { font-size: 12.5px; color: var(--ink-2); }
.row-price .bstatus { font-size: 12.5px; font-weight: 550; gap: 5px; }
.row-price .bstatus::before { width: 7px; height: 7px; }
.row-price .bstatus.none { font-weight: 500; }

.row-action { grid-area: action; position: relative; z-index: 1; display: flex; gap: 8px; }
.row-action .btn { min-width: 112px; }
@media (min-width: 641px) { .row-action .btn:not(.pick-btn) { min-width: 142px; } }
.row-no-action { grid-template-columns: 88px minmax(0, 1fr) auto; grid-template-areas: "thumb info price"; }

/* Phones: thumbnail left, name on top, price and button below. The strip goes
   and the Dodaj button keeps only its icon; "Odaberi" (pick-btn) keeps its label. */
@media (max-width: 640px) {
  .row { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "thumb info info" "thumb price action"; padding: 14px 4px; gap: 4px 12px; }
  .row-no-action { grid-template-areas: "thumb info info" "thumb price price"; }
  .row .thumb { width: 64px; height: 64px; align-self: start; }
  .row-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-items: start; gap: 2px 8px; min-width: 0; margin-top: 6px; text-align: left; }
  .row-price .price-tag { font-size: 21px; }
  .row-price .strip { display: none; }
  .row-action { align-self: end; }
  .row-action .btn, .row-action .btn:not(.pick-btn) { min-width: 0; width: 40px; padding: 0; }
  .row-action .btn .lbl { display: none; }
  .row-action .pick-btn { width: auto; padding: 0 12px; }
  .row-action .pick-btn .lbl { display: inline; }
  .row-action .pick-btn .ico { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .row { transition: none; }
}
