/* Product page (proizvod.html): the head on the tint band, the price box, the
   offers table, the price history card and the specs. Loaded after
   css/style.css and css/parts.css; the price, offer strip, shop mark, drawings
   and discount notes come from parts.css. The chart's markup is made by
   js/chart.js. */

/* ---------- layout ---------- */
/* Content on the left, the price box on the right, which spans both rows so it
   can stick while the page scrolls. The last row takes the spare height. */
.page-product .pdp {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto 1fr;
  grid-template-areas: "head buy" "main buy"; gap: 0 36px; align-items: start;
}
/* minmax(0, ...): without it the one column is as wide as the widest content and pushes the offers and the chart out of a narrow page. */
.pdp-main { grid-area: main; display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; min-width: 0; padding-top: 36px; }

/* A name that long in the crumbs stays on one line. */
.page-product .crumbs [aria-current] { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The crumbs and the head share one tint band: the crumbs paint theirs and the
   head paints the same colour 100vmax to each side, from behind the crumbs'
   bottom margin down to its own end. */
.pdp-head {
  position: relative; grid-area: head; display: grid; grid-template-columns: 232px minmax(0, 1fr);
  gap: 32px; align-items: center; padding: 8px 0 34px;
}
.pdp-head::before {
  content: ""; position: absolute; z-index: -1; left: -100vmax; right: -100vmax; top: -40px; bottom: 0;
  background: var(--tint); border-bottom: 1px solid var(--tint-2);
}

/* ---------- head ---------- */
.pdp-pic { position: relative; width: 232px; height: 232px; overflow: hidden; border-radius: var(--r-m); background: var(--surface); }
.pdp-title { min-width: 0; }
.pdp-brand { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.pdp-head h1 { margin-top: 8px; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.06; letter-spacing: -.03em; overflow-wrap: anywhere; }
/* A name that long (some shops list a whole description) would fill the head. */
.pdp-head h1.long { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; letter-spacing: -.02em; }
.pdp-specs { margin-top: 14px; font-size: 15px; color: var(--ink-2); }
.pdp-specs strong { font-weight: 650; color: var(--ink); }
.pdp-specs strong.unknown { font-weight: 500; color: var(--ink-2); }
.pdp-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 16px; font-size: 13.5px; color: var(--ink-2); }
.pdp-facts b { font-weight: 700; }
.pdp-facts b.good { color: var(--good); }
.pdp-facts code { font: 500 13px/1 var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }

/* ---------- price box ---------- */
/* The side column: the price box, then the Geekomat ad (css/promo.css). The
   column spans both rows, so the box can stick in it while the ad scrolls
   away under the box. */
.pdp-side { grid-area: buy; display: grid; gap: 20px; align-content: start; align-self: stretch; }
.buy {
  position: sticky; z-index: 1; top: 88px; margin-top: 8px; padding: 26px 26px 22px;
  border-color: var(--line-2); box-shadow: var(--shadow-md);
  /* on a short window the box scrolls inside itself, so its buttons stay reachable */
  max-height: calc(100vh - 104px); overflow-y: auto;
}
.buy-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.buy-price { margin-top: 6px; }
.buy-none { margin-top: 6px; font: 700 28px/1.15 var(--font-display); letter-spacing: -.025em; }
.buy-list { margin: 8px 0 0; display: grid; gap: 2px; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.buy-list .list-was { margin: 0; font-size: 13px; color: var(--ink-2); }
.buy-list .pay-cond { margin: 0; font-size: 13px; }
.buy-list .pay-cond .pc-long { display: block; -webkit-line-clamp: unset; max-width: none; }
.buy-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.buy-shop { font-weight: 650; color: var(--good); }
.buy-drop { font-weight: 600; color: var(--warm); font-variant-numeric: tabular-nums; }
.buy-compat { display: grid; gap: 6px; margin-top: 20px; }
.buy-compat > span:first-child { font: 500 13px/1.3 var(--font-body); color: var(--ink-3); }
.buy-compat .bstatus { align-items: flex-start; font-size: 14px; font-weight: 550; line-height: 1.4; }
.buy-compat .bstatus::before { margin-top: 6px; }
.buy-actions { display: grid; gap: 10px; margin-top: 22px; }
.buy-actions:empty { display: none; }
.buy-actions .btn { width: 100%; }
.pick-back { justify-self: center; padding: 2px 0; font-size: 14px; font-weight: 600; text-decoration: none; }
.pick-back:hover { text-decoration: underline; }
.buy-facts { display: grid; gap: 10px; margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
.buy-facts div { display: flex; justify-content: space-between; gap: 12px; }
.buy-facts dt { color: var(--ink-2); }
.buy-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.buy-actions:empty + .buy-facts { margin-top: 18px; }

/* ---------- section heads and notes ---------- */
.block-head { margin-bottom: 16px; }
.block-head h2 { letter-spacing: -.025em; }
.block-head p { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.pdp-note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.pdp-main .card { border-color: var(--line-2); }
.pdp-main .notice { padding: 16px 20px; }

/* ---------- offers ---------- */
/* The table is a table only while the card is wide enough for it (see the
   container query below): the card's width, not the window's, is what matters,
   because beside the price box the column is narrow on a wide window too. */
.offers { overflow: hidden; container: offers / inline-size; }
.offer {
  display: grid; grid-template-columns: minmax(0, 1fr) 172px 120px 104px; gap: 8px 16px; align-items: center;
  padding: 16px 20px; border-top: 1px solid var(--line);
}
.offer-head { padding-block: 10px; border-top: 0; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.offer-head span:nth-child(3) { text-align: right; }
.offer.best { background: var(--good-soft); }
.offer-shop { min-width: 0; }
.offer-shop b { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 15px; font-weight: 650; }
.offer-tag { font-size: 12.5px; font-weight: 600; color: var(--good); }
/* the name and the notes line up with the shop's name, after its 24px mark */
.offer-name, .offer-seen, .offer-shop .pay-cond { padding-left: 33px; }
.offer-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px;
  font-size: 13px; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere;
}
.offer-seen { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.offers .bstatus { font-size: 13.5px; font-weight: 500; }
/* "Dostupnost nepoznata" is grey, but still a dot with text */
.offers .bstatus.none::before { display: block; }
.offer-price { text-align: right; }
.offer-price .price-tag { display: block; font-size: 20px; line-height: 1.1; letter-spacing: -.02em; }
.offer .act { justify-self: end; display: grid; justify-items: center; gap: 3px; font-size: 13px; }
.hint { font-size: 11.5px; color: var(--ink-3); text-align: center; }

/* Narrow card: each offer is two lines, the shop and the price, then the
   availability and the button. */
@container offers (max-width: 700px) {
  .offer-head { display: none; }
  .offer { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "shop price" "avail action"; padding: 14px 16px; }
  .offer-shop { grid-area: shop; }
  .offer-price { grid-area: price; }
  .offer > .bstatus { grid-area: avail; justify-self: start; }
  .offer > .act { grid-area: action; }
  /* the button's own label ("Otvori", "Traži") already says what it opens */
  .offer .hint { display: none; }
}

/* ---------- price history card ---------- */
.chart-card { padding: 0 0 14px; overflow: hidden; }
.chart-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--tint); border-bottom: 1px solid var(--tint-2); }
.chart-stat { display: grid; gap: 2px; min-width: 0; padding: 14px 20px; border-left: 1px solid var(--tint-2); }
.chart-stat:first-child { border-left: 0; }
.chart-stat span { font-size: 12.5px; color: var(--ink-2); }
.chart-stat b { font: 700 21px/1.15 var(--font-display); letter-spacing: -.02em; }
.chart-stat.lo b { color: var(--good); }
.chart-stat small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-3); }

/* The legend's chips show or hide a shop's line. */
.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 14px 20px 4px; }
.legend .chip { height: 30px; padding: 0 10px 0 8px; border-color: transparent; background: none; color: var(--ink); font-weight: 600; }
.legend .chip:hover { background: var(--surface-2); color: var(--ink); }
.legend .chip[aria-pressed="false"] { opacity: .45; font-weight: 500; text-decoration: line-through; }
.legend .chip small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.legend .chip.ended { color: var(--ink-2); }
.legend .chip.ended .sw { opacity: .5; }
.sw { flex: none; width: 14px; height: 3px; border-radius: 2px; }

.plot { position: relative; margin: 0 20px; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.plot text { font: 400 11.5px/1 var(--font-body); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.plot .gl { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.plot .base { stroke: var(--line-2); stroke-width: 1; }
.plot .ln { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.plot .ended { opacity: .45; }
.plot .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tip {
  position: absolute; z-index: 3; width: max-content; min-width: 170px; max-width: 270px; padding: 10px 12px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-lg); font-size: 13px;
}
.tip-date { margin-bottom: 6px; font-size: 12px; color: var(--ink-3); }
.tip ul { display: grid; gap: 4px; }
.tip li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.tip-shop { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tip li b { font: 700 15px/1.2 var(--font-display); letter-spacing: -.01em; }
.tip li.tip-more { display: block; color: var(--ink-3); }
.tip-none { color: var(--ink-3); }
.chart-note { margin: 10px 20px 0; font-size: 12.5px; color: var(--ink-3); }
.chart-table { margin: 12px 20px 0; font-size: 13.5px; }
.chart-table summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.chart-table .table-wrap { max-height: 360px; margin-top: 10px; overflow: auto; }
.chart-table .table thead th { position: sticky; top: 0; }
.chart-table .table td { font-variant-numeric: tabular-nums; }

/* ---------- specs ---------- */
/* Groups flow in columns, not grid rows: a board has eight groups of very
   different length, and rows would leave a gap under each short one. The
   groups' top spacing is padding, so every column starts level. */
.specs { columns: 3 270px; column-gap: 48px; padding: 4px 26px 22px; }
.spec-group { break-inside: avoid; padding-top: 22px; }
.spec-group h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.01em; }
.spec-group dl { margin: 0; }
.spec-group dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec-group dl > div:last-child { border-bottom: 0; }
.spec-group dt { color: var(--ink-2); }
/* Values keep the line breaks the formatters make (back-panel ports, M.2 sizes). */
.spec-group dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: pre-line; overflow-wrap: anywhere; }
/* A long or many-line value (slots, ports, outputs) takes the row's width under its label, one item to a line. */
.spec-group dl > div.stack { display: block; }
.spec-group .stack dd { margin-top: 4px; line-height: 1.5; text-align: left; }

/* ---------- one column ---------- */
@media (max-width: 1020px) {
  .page-product .pdp { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "head" "buy" "main"; }
  .pdp-head { padding-bottom: 0; }
  /* the tint reaches a little below the head, behind the top of the price box */
  .pdp-head::before { bottom: -56px; }
  .buy { position: static; max-height: none; margin-top: 20px; }
  .pdp-side { gap: 16px; }
}

@media (max-width: 720px) {
  .pdp-head { grid-template-columns: 104px minmax(0, 1fr); gap: 16px; align-items: start; }
  .pdp-pic { width: 104px; height: 104px; }
  /* leave room under the drawing for its caption */
  .pdp-pic .pic-credit > .art { box-sizing: border-box; padding-bottom: 14px; }
  .pdp-pic .pic-credit > .art svg { width: 82%; height: 82%; }
  .pdp-specs { margin-top: 10px; font-size: 14px; }
  .pdp-facts { margin-top: 12px; }
  .buy { padding: 22px 18px 18px; }
  .buy-list .pay-cond .pc-long { display: none; }
  .pdp-main { gap: 44px; padding-top: 32px; }

  .chart-sum { grid-template-columns: 1fr 1fr; }
  .chart-stat { padding: 12px 16px; }
  .chart-stat:nth-child(3) { border-left: 0; }
  .chart-stat:nth-child(n+3) { border-top: 1px solid var(--tint-2); }
  .legend, .plot, .chart-note, .chart-table { margin-inline: 14px; }
  .specs { padding: 0 18px 16px; }
}
