/**
 * Feature 035 — DPD shop chrome: Add-to-Cart button.
 *
 * Primary buy action = DPD red, matching the header "START FREE" CTA so the whole
 * site has one action colour. Self-scoped under `body.dpd-chrome` (site-wide class,
 * see inc/header.php) and depends on dpd-tokens.css for the palette. Values also carry
 * literal fallbacks so this file ports 1:1 to the Slovenian child theme even if the
 * token names ever drift.
 *
 * Covers: shop/archive loop buttons + the single-product add-to-cart button.
 * Deliberately NOT touching cart/checkout "Proceed" buttons — only the buy action.
 */

body.dpd-chrome {
  /* button-local tokens (derive from the shared palette; fall back to literals) */
  --btn-bg:        var(--red, #DC0028);
  --btn-bg-hover:  var(--red-deep, #A8001F);
  --btn-bg-active: #8E001A;
  --btn-fg:        var(--paper, #FBFAF7);
}

/* Shop loop (archive grid) + single-product add-to-cart. Scope + class stack gives us
   enough specificity to win over Shoptimizer's accent without !important. */
body.dpd-chrome.woocommerce ul.products li.product a.button.add_to_cart_button,
body.dpd-chrome.woocommerce ul.products li.product a.button.product_type_simple,
body.dpd-chrome.woocommerce a.button.add_to_cart_button,
body.dpd-chrome.woocommerce button.single_add_to_cart_button.button.alt,
body.dpd-chrome.woocommerce .single_add_to_cart_button.button {
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

/* Hover / focus — darken (never brighten red) + a subtle red-tinted lift. */
body.dpd-chrome.woocommerce ul.products li.product a.button.add_to_cart_button:hover,
body.dpd-chrome.woocommerce ul.products li.product a.button.product_type_simple:hover,
body.dpd-chrome.woocommerce a.button.add_to_cart_button:hover,
body.dpd-chrome.woocommerce button.single_add_to_cart_button.button.alt:hover,
body.dpd-chrome.woocommerce .single_add_to_cart_button.button:hover,
body.dpd-chrome.woocommerce ul.products li.product a.button.add_to_cart_button:focus-visible,
body.dpd-chrome.woocommerce a.button.add_to_cart_button:focus-visible,
body.dpd-chrome.woocommerce button.single_add_to_cart_button.button.alt:focus-visible,
body.dpd-chrome.woocommerce .single_add_to_cart_button.button:focus-visible {
  background-color: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  color: var(--btn-fg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 0, 40, .25);
}

/* Keyboard focus ring (in addition to the hover styling above). */
body.dpd-chrome.woocommerce a.button.add_to_cart_button:focus-visible,
body.dpd-chrome.woocommerce button.single_add_to_cart_button.button.alt:focus-visible,
body.dpd-chrome.woocommerce .single_add_to_cart_button.button:focus-visible {
  outline: 3px solid rgba(220, 0, 40, .4);
  outline-offset: 2px;
}

/* Pressed. */
body.dpd-chrome.woocommerce a.button.add_to_cart_button:active,
body.dpd-chrome.woocommerce button.single_add_to_cart_button.button.alt:active,
body.dpd-chrome.woocommerce .single_add_to_cart_button.button:active {
  background-color: var(--btn-bg-active);
  border-color: var(--btn-bg-active);
  transform: translateY(0);
  box-shadow: none;
}

/* "Added" / loading state — keep it red so the button doesn't flash the theme accent. */
body.dpd-chrome.woocommerce a.button.add_to_cart_button.added,
body.dpd-chrome.woocommerce a.button.add_to_cart_button.loading {
  background-color: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  color: var(--btn-fg);
}

/* -----------------------------------------------------------------------------
 * Sale badge → "savings seal" (feature 036 shop polish).
 *
 * Shoptimizer prints the sale badge as `span.sale-item.product-label.type-bubble`,
 * a flat red rectangle pinned top-LEFT — where it collides with the `dpd` logo baked
 * into every product image, and in the theme's off-brand red (#dd3333). We restyle that
 * same element into a circular red "deal stamp" in the top-RIGHT corner, using the brand
 * red so it matches the Add-to-Cart CTA above.
 *
 * The discount % stays fully dynamic: WooCommerce still computes and prints the text node
 * (e.g. `-28%`); we only reposition + reskin the element and add a static "POPUST" label
 * via ::after. No markup/PHP change, so it ports 1:1 to the SI child theme.
 *
 * Offset parent is `.woocommerce-image__wrapper` (position:relative); the whole chain has
 * overflow:visible, so the -8deg rotation never clips.
 * -------------------------------------------------------------------------- */
body.dpd-chrome.woocommerce ul.products li.product span.sale-item.type-bubble {
  /* reposition: clear the top-left logo zone */
  top: 12px;
  right: 12px;
  left: auto;

  /* circular stamp */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  background-color: var(--red, #DC0028);
  border: 2px solid rgba(255, 255, 255, .28);
  box-shadow: 0 3px 12px rgba(220, 0, 40, .32);
  transform: rotate(-8deg);

  /* the % text node */
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

/* "POPUST" caption under the % (same word in HR & SI). */
body.dpd-chrome.woocommerce ul.products li.product span.sale-item.type-bubble::after {
  content: "POPUST";
  margin-top: 3px;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .92;
}

@media (prefers-reduced-motion: no-preference) {
  body.dpd-chrome.woocommerce ul.products li.product:hover span.sale-item.type-bubble {
    transform: rotate(-8deg) scale(1.06);
    transition: transform .18s ease;
  }
}

/* -----------------------------------------------------------------------------
 * Single-product short-description typography (feature 037 — body readability).
 *
 * Shoptimizer renders the product short description at 14px / 1.5, which reads
 * cramped for prose. Bump to 16px with a more open 1.65 line-height and paragraph
 * rhythm so the description is comfortable to read. The face stays Inter (inherited
 * site body font) — we only tune size/leading/spacing. The summary column already
 * caps the measure at ~66ch, so no max-width is forced. Class-stack specificity wins
 * over the theme without !important; scoped under body.dpd-chrome so it ports 1:1 to SI.
 * -------------------------------------------------------------------------- */
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description,
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description p,
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description li {
  font-size: 16px;
  line-height: 1.65;
}
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description p {
  margin-bottom: 1em;
}
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description p:last-child {
  margin-bottom: 0;
}

/* Headings — the theme renders h2/h3 as flat Inter 600 at 30px/24px (only a 6px step,
 * same weight, muted #222), so the lead and the repeated subsection titles read alike.
 * Retune for a clearer scale (28 → 20) on the brand ink, and mark each subsection with a
 * short DPD-red rule so "Što dobivate / Za koga / Nakon 20 naljepnica" scan at a glance and
 * tie back to the red Add-to-Cart CTA. Tokens carry literal fallbacks for the SI port. */
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description h2 {
  /* fluid so it never overtakes the product title, which the theme drops to 24px on
   * mobile: 28px on desktop, easing down to ~22px on phones. */
  font-size: clamp(22px, 5.5vw, 28px);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink, #16140F);
  margin: 4px 0 18px;
}
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description h3 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink, #16140F);
  margin: 32px 0 12px;
}
body.dpd-chrome.woocommerce .woocommerce-product-details__short-description h3::before {
  content: "";
  display: block;
  width: 30px;
  height: 3px;
  margin-bottom: 12px;
  border-radius: 2px;
  background: var(--red, #DC0028);
}

/* Product title — the theme renders it flat Inter 600 in muted #222. Anchor the summary
 * scale (h1 36 → h2 28 → h3 20) by giving it real weight, the brand ink and tighter
 * tracking so the plugin name reads as a confident lead, not body-weight text. */
body.dpd-chrome.woocommerce .product_title.entry-title {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink, #16140F);
  margin: 0 0 10px;
}
