/*
 * happydrewienko - product page (plugin).
 *
 * Enqueued on is_product() only, after assets/css/base.css and assets/css/name-field.css (contract
 * §19). It lays out the page the approved mockup draws and styles everything the plugin and the
 * theme render on it:
 *
 *   .hd-product-top    gallery + buy box (Product_Page::open_top/close_top)
 *   .hd-name-overlay   the name preview on the main photo - its look lives in name-field.css,
 *                      only what is specific to the gallery is here
 *   .hd-personalization  the block around the name field (the field itself: name-field.css) and
 *                      the letterform cards (templates/product-fields.php)
 *   .hd-facts, .hd-gift-nudge  under the button (templates/fact-strip.php, gift-nudge.php)
 *   .hd-product-more   reviews + details (templates/product-reviews.php, theme tabs.php)
 *   .related.products  "Inne lampki"
 *   .hd-buy-sticky     the sticky mobile buy bar (templates/sticky-buy.php)
 *
 * Specificity: WooCommerce's and Storefront's stylesheets print AFTER this one and style the same
 * elements through `.single-product div.product …`. Rules that have to win over them therefore
 * start from `.single-product.hd-product div.product`, one class more than Storefront's own.
 *
 * Everything here works without JavaScript: the label floats through :placeholder-shown, the
 * letterform follows the checked radio through :has(), and the details are native <details>.
 * assets/js/personalization.js adds the ok / error colours and keeps the previews in step.
 *
 * Mobile first. Verified target: no horizontal overflow at 360px. Colours: tokens only.
 */

/* ------------------------------------------------------------------ *
 * 1. Letterforms and the engraving colour: defined in name-field.css (shared with the front page).
 * ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ *
 * 2. Page layout
 *
 * Storefront gives div.product `overflow: hidden` as a float clearfix. It would clip the
 * full-bleed gallery on a phone, so it is released here; nothing inside floats any more, and
 * ::after still clears.
 *
 * The gallery is deliberately NOT sticky: Storefront's #page carries overflow-x: hidden, which
 * makes it the scroll container of everything inside and switches position: sticky off for the
 * whole page (the site header included). On a laptop the photo and the name field share the
 * first screen anyway, so the preview is in view while the name is typed.
 * ------------------------------------------------------------------ */

.single-product.hd-product div.product {
  overflow: visible;
}

.hd-product-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.single-product.hd-product div.product .hd-product-top > .woocommerce-product-gallery,
.single-product.hd-product div.product .hd-product-top > .summary {
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
}

/* The sale flash would otherwise take a grid cell of its own. */
.single-product.hd-product div.product .hd-product-top > .onsale {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 3;
  margin: 0;
}

.hd-product-more {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1.75rem;
}

/* Storefront parks the photo up to 4em under the breadcrumb; the photo is the first thing to see. */
.single-product.hd-product .storefront-breadcrumb {
  margin-bottom: 0;
  padding-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .hd-product-top {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .hd-product-top {
    gap: 3rem;
  }

  .hd-product-more {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
    margin-top: 2.5rem;
  }
}

/* ------------------------------------------------------------------ *
 * 3. Gallery
 * ------------------------------------------------------------------ */

.single-product.hd-product div.product .woocommerce-product-gallery .flex-viewport,
.single-product.hd-product div.product .woocommerce-product-gallery__wrapper {
  margin: 0;
  background-color: var(--hd-surface);
}

.single-product.hd-product div.product .woocommerce-product-gallery__image {
  position: relative;
}

.single-product.hd-product div.product .woocommerce-product-gallery__image img {
  display: block;
  width: 100%;
  height: auto;
}

.single-product.hd-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
  top: 0.75rem;
  right: 0.75rem;
}

/* Storefront's clearfix pseudo-elements would take the first cell of the thumbnail row. */
.single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs::before,
.single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs::after {
  content: none;
  display: none;
}

/*
 * Phone: the photo runs edge to edge and dots replace the thumbnails. The gutter on a phone is
 * Storefront's .col-full margin plus the theme's padding, so the gallery is pulled out by exactly
 * the distance to the viewport edge rather than by a hardcoded figure. Each dot keeps a 24px tap
 * target: the thumbnail image itself, made transparent.
 */
@media (max-width: 767px) {
  .single-product.hd-product div.product .hd-product-top > .woocommerce-product-gallery {
    margin: 0 calc(50% - 50vw) 1.1rem;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs {
    display: flex;
    justify-content: center;
    gap: 0.15rem;
    margin: 0.4rem 0 0;
    padding: 0;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) {
    position: relative;
    float: none;
    clear: none;
    width: 24px;
    height: 24px;
    margin: 0;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n)::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background-color: var(--hd-border);
    border-radius: 999px;
    transition: width 0.2s ease, margin 0.2s ease, background-color 0.2s ease;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n):has(img.flex-active)::before {
    width: 16px;
    margin-left: -8px;
    background-color: var(--hd-accent-dark);
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
  }
}

/* Wider: the photo gets its rounded frame and the thumbnails become one even row of five. */
@media (min-width: 768px) {
  .single-product.hd-product div.product .woocommerce-product-gallery .flex-viewport,
  .single-product.hd-product div.product .woocommerce-product-gallery__wrapper {
    border-radius: var(--hd-radius-lg);
    overflow: hidden;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0.75rem 0 0;
    padding: 0;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) {
    float: none;
    clear: none;
    width: auto;
    margin: 0;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    opacity: 0.7;
  }

  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n) img.flex-active {
    border-color: var(--hd-accent-dark);
    box-shadow: 0 0 0 1px var(--hd-accent-dark);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .single-product.hd-product div.product .hd-product-top .woocommerce-product-gallery .flex-control-thumbs li:nth-child(n)::before {
    transition: none;
  }
}

/* ------------------------------------------------------------------ *
 * 4. Name preview on the main photo (templates/gallery-overlay.php)
 * The preview's look is in name-field.css; here only what belongs to the gallery.
 * ------------------------------------------------------------------ */

/*
 * Letterform switch without JavaScript: the :has() pair reads the checked radio directly, so the
 * preview also follows a change made with scripts off (and out-specifies name-field.css's
 * data-hd-font rule in both directions).
 */
.single-product.hd-product div.product:has(.hd-fontpick__input[value="classic"]:checked) .hd-name-overlay__text {
  font-family: var(--hd-letter-classic);
  font-weight: 400;
}

.single-product.hd-product div.product:has(.hd-fontpick__input[value="rounded"]:checked) .hd-name-overlay__text {
  font-family: var(--hd-letter-rounded);
  font-weight: 700;
}

/* The zoom shows the real photograph under the pointer; a preview on top of it would not line up. */
@media (hover: hover) {
  .woocommerce-product-gallery__image:hover > .hd-name-overlay,
  .woocommerce-product-gallery__image:hover > .hd-name-overlay__tag {
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ *
 * 5. Buy box: title, price, lead
 * ------------------------------------------------------------------ */

.single-product.hd-product div.product .summary .product_title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.single-product.hd-product div.product .summary .woocommerce-product-rating {
  margin: 0 0 0.5rem;
}

.single-product.hd-product div.product .summary p.price {
  margin: 0 0 0.85rem;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
}

.single-product.hd-product div.product .summary p.price .woocommerce-price-suffix {
  margin-left: 0.3rem;
  color: var(--hd-text-muted);
  font-family: var(--hd-font-body);
  font-size: 0.8rem;
  font-weight: 400;
}

.single-product.hd-product div.product .summary .woocommerce-product-details__short-description {
  margin: 0 0 1.1rem;
  color: var(--hd-text-muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.hd-product .hd-short,
.hd-product .hd-short > p {
  margin: 0;
}

/* ------------------------------------------------------------------ *
 * 6. The add-to-cart form
 * The fields take the full width, then quantity and button share one row.
 * ------------------------------------------------------------------ */

.single-product.hd-product div.product form.cart {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0;
}

/* Storefront's clearfix pseudo-elements would become empty flex items. */
.single-product.hd-product div.product form.cart::before,
.single-product.hd-product div.product form.cart::after {
  content: none;
  display: none;
}

.single-product.hd-product div.product form.cart > .hd-personalization {
  flex: 1 1 100%;
}

.single-product.hd-product div.product form.cart > .hd-personalization-option,
.single-product.hd-product div.product form.cart > .hd-product-gift { flex: 1 1 100%; min-width: 0; margin: 0; }
.hd-personalization-option { border: 1px solid var(--hd-border); border-radius: var(--hd-radius-sm); background: var(--hd-surface); }
.hd-personalization-option > .hd-product-option__toggle { display: flex; align-items: center; gap: 0.75rem; min-height: 48px; padding: 0.65rem 0.85rem; color: var(--hd-accent-dark); font-size: 1rem; font-weight: 700; cursor: pointer; list-style: none; }
.hd-product-option__toggle::-webkit-details-marker { display: none; }
.hd-product-option__toggle::after { content: "+"; font-size: 1.4rem; }
.hd-personalization-option[open] > .hd-product-option__toggle::after { content: "-"; }
.hd-product-option__price { margin-left: auto; white-space: nowrap; font-size: 0.9rem; font-weight: 600; }
.hd-personalization-option > .hd-personalization { padding: 0.85rem; border-top: 1px solid var(--hd-border); }
.hd-product-gift { padding: 0.65rem 0; }
.hd-product-gift__toggle { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; margin: 0; font-size: 0.9rem; cursor: pointer; }
.hd-product-gift__toggle input { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--hd-accent-dark); }
.hd-product-gift__toggle .hd-product-option__price { font-size: 0.85rem; }
.hd-product-gift__card { padding: 0.65rem 0 0; }
.hd-product-gift:not(:has(input:checked)) .hd-product-gift__card { display: none; }
.hd-product-gift__card label { display: block; font-size: 0.85rem; margin-bottom: 0.4rem; }
.hd-product-gift__card textarea { display: block; width: 100%; min-height: 90px; padding: 0.7rem; font-size: 1rem; border: 1px solid var(--hd-border); border-radius: var(--hd-radius-sm); background: var(--hd-surface); }
.hd-product-option__toggle:focus-visible { outline: 2px solid var(--hd-accent-dark); outline-offset: 3px; }

.single-product.hd-product div.product form.cart .quantity {
  float: none;
  flex: 0 0 auto;
  margin: 0;
}

/* Sold individually: WooCommerce keeps a hidden input in the wrapper, and no gap is needed. */
.single-product.hd-product div.product form.cart .quantity:has(> input[type="hidden"]:only-child) {
  display: none;
}

.single-product.hd-product div.product form.cart .quantity .qty {
  width: 4.25rem;
  height: 100%;
  min-height: 52px;
  padding: 0 0.4rem;
  background-color: var(--hd-field);
  text-align: center;
}

.single-product.hd-product div.product form.cart .single_add_to_cart_button {
  float: none;
  flex: 1 1 12rem;
  min-height: 52px;
  margin: 0;
  border-radius: var(--hd-radius-sm);
}

/* ------------------------------------------------------------------ *
 * 7. Personalisation block (templates/product-fields.php)
 * ------------------------------------------------------------------ */

.hd-personalization {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  margin: 0 0 0.35rem;
}

.hd-personalization__note {
  margin: 0;
  color: var(--hd-text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.hd-personalization__edit {
  margin: 0;
}

/* The name field itself (.hd-name-field, .hd-float): name-field.css. */

/* Letterform cards: each shows the typed name in its own letters. Storefront tints every fieldset
   and legend a cool near-white, which reads as a stray strip on the warm page. */
.single-product.hd-product .hd-personalization__fonts {
  min-width: 0;
  margin: 0.2rem 0 0;
  padding: 0;
  background: none;
  border: 0;
}

.single-product.hd-product .hd-personalization__legend {
  margin: 0 0 0.45rem;
  padding: 0;
  background: none;
  color: var(--hd-field-label);
  font-family: var(--hd-font-head);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.hd-fontpick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.hd-fontpick__option {
  position: relative;
  display: grid;
  align-content: center;
  gap: 0.1rem;
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 0.5rem 0.8rem;
  background-color: var(--hd-field);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-sm);
  color: var(--hd-text);
  font-family: var(--hd-font-body);
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.hd-fontpick__option:hover {
  border-color: var(--hd-accent-dark);
}

/* .is-selected is set by personalization.js for browsers without :has(). */
.hd-fontpick__option:has(.hd-fontpick__input:checked),
.hd-fontpick__option.is-selected {
  background-color: var(--hd-surface);
  border-color: var(--hd-accent-dark);
  box-shadow: inset 0 0 0 1px var(--hd-accent-dark);
}

.hd-fontpick__option:has(.hd-fontpick__input:focus-visible) {
  outline: 3px solid var(--hd-accent-dark);
  outline-offset: 2px;
}

/* The real radio covers the whole card: the card is the control, for the pointer and the keyboard. */
.single-product.hd-product .hd-fontpick__option .hd-fontpick__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* The engraving colour, as on the photo: --hd-wood-dark read 3.3:1 on the card and failed AA. */
.hd-fontpick__sample {
  min-width: 0;
  overflow: hidden;
  color: var(--hd-engrave);
  font-size: 1.15rem;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hd-fontpick__sample--rounded {
  font-family: var(--hd-letter-rounded);
  font-weight: 700;
}

.hd-fontpick__sample--classic {
  font-family: var(--hd-letter-classic);
  font-weight: 400;
}

.hd-fontpick__label {
  min-width: 0;
  color: var(--hd-text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* ------------------------------------------------------------------ *
 * 8. Low stock badge (Personalization::low_stock_html)
 * ------------------------------------------------------------------ */

.hd-low-stock {
  display: inline-block;
  justify-self: start;
  margin: 0.25rem 0 0;
  padding: 0.3rem 0.65rem;
  background-color: var(--hd-surface);
  border: 1px solid var(--hd-warning);
  border-radius: var(--hd-radius-sm);
  color: var(--hd-warning);
  font-family: var(--hd-font-head);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
}

/* ------------------------------------------------------------------ *
 * 9. Fact strip (templates/fact-strip.php)
 * Four one-line answers under the add-to-cart button. A <dl>, so the label really is
 * the term and the value really is its definition; the rows wrap at 360px instead of
 * squeezing a date onto two characters.
 * ------------------------------------------------------------------ */

.hd-facts {
  margin: 0 0 0.75rem;
  padding: 0.15rem 0.9rem;
  background-color: var(--hd-surface);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-sm);
}

.hd-facts__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.9rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hd-border);
}

.hd-facts__row:last-child {
  border-bottom: 0;
}

.hd-facts__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--hd-text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.hd-facts__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--hd-accent-dark);
}

.hd-facts__value {
  min-width: 0;
  margin: 0;
  margin-left: auto;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: right;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.hd-facts__link {
  color: var(--hd-accent-dark);
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * 10. Gift wrapping sentence (templates/gift-nudge.php)
 * ------------------------------------------------------------------ */

.hd-gift-nudge {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  background-color: var(--hd-surface);
  border: 1px dashed var(--hd-accent-dark);
  border-radius: var(--hd-radius-sm);
}

.hd-gift-nudge__icon {
  box-sizing: border-box;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.45rem;
  background-color: var(--hd-bg);
  border-radius: 50%;
  color: var(--hd-accent-dark);
}

.hd-gift-nudge__text {
  margin: 0;
  color: var(--hd-text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.hd-gift-nudge__title {
  display: block;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-size: 0.92rem;
}

/* ------------------------------------------------------------------ *
 * 11. Reviews (templates/product-reviews.php + WooCommerce's reviews template)
 * ------------------------------------------------------------------ */

.hd-reviews {
  min-width: 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--hd-border);
}

.hd-reviews__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin: 0 0 0.75rem;
}

.hd-reviews__title {
  margin: 0;
  font-size: 1.2rem;
}

.hd-reviews__score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hd-reviews__average {
  font-family: var(--hd-font-head);
  font-size: 1.3rem;
  font-weight: 800;
}

.hd-reviews__count {
  color: var(--hd-text-muted);
  font-size: 0.9rem;
}

.single-product.hd-product .hd-reviews .star-rating {
  float: none;
  margin: 0;
  color: var(--hd-accent-dark);
}

.hd-reviews-intro {
  max-width: 58ch;
  margin: 0 0 1rem;
  color: var(--hd-text-muted);
  line-height: 1.7;
}

/* The section has its own heading and invitation; WooCommerce's copies would repeat them. */
.single-product.hd-product .hd-reviews #reviews .woocommerce-Reviews-title,
.single-product.hd-product .hd-reviews #reviews .woocommerce-noreviews {
  display: none;
}

.single-product.hd-product .hd-reviews #reviews .commentlist {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1rem;
  padding: 0;
}

.single-product.hd-product .hd-reviews #reviews .commentlist li {
  margin: 0;
}

.single-product.hd-product .hd-reviews #reviews .commentlist li .comment_container {
  padding: 0.85rem 1rem;
  background-color: var(--hd-surface);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-sm);
}

/* No avatar any more (Product_Page::trim_summary), so the text takes the whole card. */
.single-product.hd-product .hd-reviews #reviews .commentlist li .comment_container .comment-text {
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
}

.single-product.hd-product .hd-reviews #reviews .commentlist li .comment_container .comment-text .star-rating {
  float: none;
  margin: 0 0 0.35rem;
}

.single-product.hd-product .hd-reviews #reviews .commentlist li p.meta {
  margin: 0 0 0.35rem;
  color: var(--hd-text-muted);
  font-size: 0.85rem;
}

/* "Napisz opinię": the form folds away until someone wants it. */
.hd-review-write {
  margin: 0;
}

.hd-review-write > .hd-review-write__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  background-color: var(--hd-surface);
  border: 2px solid var(--hd-accent-dark);
  border-radius: var(--hd-radius-sm);
  color: var(--hd-accent-dark);
  font-family: var(--hd-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.hd-review-write > .hd-review-write__toggle::-webkit-details-marker {
  display: none;
}

.hd-review-write > .hd-review-write__toggle:hover {
  background-color: var(--hd-bg);
}

.hd-review-write > .hd-review-write__toggle:focus-visible {
  outline: 3px solid var(--hd-accent-dark);
  outline-offset: 2px;
}

.hd-review-write[open] > .hd-review-write__toggle {
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------------ *
 * 12. Details (theme woocommerce/single-product/tabs/tabs.php)
 * One list of titles that open in place: Opis, Specyfikacja, Dostawa i zwroty, Pytania.
 * ------------------------------------------------------------------ */

.hd-details {
  min-width: 0;
  margin-top: 1.75rem;
  border-top: 1px solid var(--hd-border);
}

@media (min-width: 1024px) {
  .hd-details {
    margin-top: 0;
  }
}

.hd-details__item {
  border-bottom: 1px solid var(--hd-border);
}

.hd-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 54px;
  padding: 0.4rem 0.15rem;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}

.hd-details__summary::-webkit-details-marker {
  display: none;
}

/* A chevron drawn from two borders: no icon font, no image request. */
.hd-details__summary::after {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.3rem;
  border-right: 2px solid var(--hd-text-muted);
  border-bottom: 2px solid var(--hd-text-muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.16s ease;
}

.hd-details__item[open] > .hd-details__summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.hd-details__summary:hover {
  color: var(--hd-accent-dark);
}

.hd-details__summary:focus-visible {
  outline: 3px solid var(--hd-accent-dark);
  outline-offset: 2px;
}

.hd-details__panel {
  min-width: 0;
  padding: 0 0.15rem 1.25rem;
}

.hd-details__panel > :last-child,
.hd-tab > :last-child {
  margin-bottom: 0;
}

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

/* Section content: the seeded description copy. */
.hd-product .hd-desc__lead p {
  font-size: 1.02rem;
  line-height: 1.7;
}

.hd-product .hd-list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.hd-product .hd-list > li {
  position: relative;
  margin: 0 0 0.6rem;
  padding-left: 1.5rem;
  line-height: 1.6;
}

.hd-product .hd-list > li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0.3rem;
  width: 0.45rem;
  height: 0.45rem;
  background-color: var(--hd-accent-dark);
  border-radius: 50%;
}

.hd-product .hd-steps {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.hd-product .hd-steps > li {
  margin: 0 0 0.7rem;
  padding-left: 0.35rem;
  line-height: 1.6;
}

.hd-product .hd-steps > li::marker {
  color: var(--hd-accent-dark);
  font-family: var(--hd-font-head);
  font-weight: 700;
}

/* Specyfikacja: fixed layout keeps long [DO POTWIERDZENIA] values from widening the page. */
.hd-product .hd-spec {
  width: 100%;
  table-layout: fixed;
  margin: 0 0 1rem;
  border-collapse: collapse;
  background-color: var(--hd-surface);
}

.hd-product .hd-spec caption {
  margin-bottom: 0.5rem;
  color: var(--hd-text-muted);
  font-size: 0.875rem;
  text-align: left;
}

.hd-product .hd-spec th,
.hd-product .hd-spec td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--hd-border);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.hd-product .hd-spec th {
  width: 42%;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-weight: 700;
}

.hd-product .hd-spec tr:last-child th,
.hd-product .hd-spec tr:last-child td {
  border-bottom: 0;
}

/* "Ważne": the safety notice is the point of the section, so it gets more air. */
.hd-product #wazne .hd-safety {
  margin-top: 0.75rem;
}

.hd-tab__title {
  margin: 1.5rem 0 0.6rem;
  color: var(--hd-text);
  font-family: var(--hd-font-head);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

.hd-tab__title:first-child {
  margin-top: 0;
}

.hd-tab__sep {
  color: var(--hd-text-muted);
}

.hd-tab__price {
  font-family: var(--hd-font-head);
  font-weight: 700;
  white-space: nowrap;
}

.hd-tab__link {
  color: var(--hd-accent-dark);
  font-weight: 700;
  text-underline-offset: 2px;
}

/* Pytania: the five questions are light rows inside the section, not cards inside a card. */
.hd-product .hd-tab--faq details.hd-card {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--hd-border);
  border-radius: 0;
  box-shadow: none;
}

.hd-product .hd-tab--faq details.hd-card:first-child {
  border-top: 0;
}

.hd-product .hd-tab--faq details.hd-card > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.55rem 0;
  color: var(--hd-text);
  font-family: var(--hd-font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  list-style: none;
  cursor: pointer;
}

.hd-product .hd-tab--faq details.hd-card > summary::-webkit-details-marker {
  display: none;
}

.hd-product .hd-tab--faq details.hd-card > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--hd-accent-dark);
  font-size: 1.25rem;
  line-height: 1;
}

.hd-product .hd-tab--faq details.hd-card[open] > summary::after {
  content: "\2212"; /* minus sign */
}

.hd-product .hd-tab--faq details.hd-card > summary:focus-visible {
  outline: 3px solid var(--hd-accent-dark);
  outline-offset: 2px;
}

.hd-product .hd-tab--faq details.hd-card > *:not(summary) {
  margin: 0 0 0.9rem;
  color: var(--hd-text-muted);
  line-height: 1.6;
}

/* ------------------------------------------------------------------ *
 * 13. Other lamps (WooCommerce related products, "Inne lampki")
 * A strip the thumb scrolls sideways on a phone; one row of three from 768px.
 * The theme's catalogue grid is the base; only the strip's own geometry is set here.
 * ------------------------------------------------------------------ */

.single-product.hd-product div.product .related.products {
  clear: both;
  margin: 2.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hd-border);
}

.single-product.hd-product div.product .related.products > h2 {
  margin: 0 0 0.9rem;
  font-size: 1.2rem;
  text-align: left;
}

/*
 * The strip runs to the screen edge (same pull-out as the gallery) while its first card lines up
 * with the text column. scroll-padding cannot take the same calc() - its percentages resolve
 * against the strip itself - so it spells out the phone gutter: Storefront's 1.41575em .col-full
 * margin plus the theme's 16px. "proximity" keeps the browser from snapping the first card to
 * the screen edge on load.
 */
.single-product.hd-product div.product .related.products ul.products {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 42%;
  grid-template-columns: none;
  gap: 0.75rem;
  margin: 0 calc(50% - 50vw);
  padding: 0 calc(50vw - 50%) 0.25rem;
  overflow-x: auto;
  scroll-padding-inline: calc(1.41575rem + 16px);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.single-product.hd-product div.product .related.products ul.products::before,
.single-product.hd-product div.product .related.products ul.products::after {
  content: none;
  display: none;
}

.single-product.hd-product div.product .related.products ul.products::-webkit-scrollbar {
  display: none;
}

.single-product.hd-product div.product .related.products ul.products li.product {
  scroll-snap-align: start;
}

.single-product.hd-product div.product .related.products ul.products li.product a img {
  margin: 0 0 0.6rem;
  border-radius: var(--hd-radius);
}

.single-product.hd-product div.product .related.products ul.products li.product .woocommerce-loop-product__title {
  font-size: 0.95rem;
}

.single-product.hd-product div.product .related.products ul.products li.product .price {
  font-size: 0.9rem;
}

.single-product.hd-product div.product .related.products .hd-loop-tag {
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .single-product.hd-product div.product .related.products ul.products {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(3, minmax(0, 15rem));
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
}

/* ------------------------------------------------------------------ *
 * 14. Sticky mobile buy bar (templates/sticky-buy.php + assets/js/product-sticky.js)
 *
 * Hidden by default and only ever laid out below 768px. `visibility` does the hiding on
 * purpose: it keeps the button out of the tab order while the bar is off screen, so the
 * aria-hidden the script toggles can never sit on a focusable element.
 *
 * z-index 800 keeps it under the cart's own sticky bar (900), the mini-cart drawer (9990)
 * and the cookie banner (9995) - it must never cover either of the last two.
 * ------------------------------------------------------------------ */

.hd-buy-sticky {
  display: none;
}

@media (max-width: 768px) {
  .hd-buy-sticky {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 16px calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background-color: var(--hd-surface, #FFFFFF);
    border-top: 1px solid var(--hd-border, #CFE6DA);
    box-shadow: var(--hd-shadow-lg, 0 12px 34px rgba(18, 42, 34, 0.16));
    visibility: hidden;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
  }

  .hd-buy-sticky.is-visible {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  /* Price on top, the lamp - or "z imieniem „Zosia”" - under it. */
  .hd-buy-sticky__info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column-reverse;
    min-width: 0;
  }

  .hd-buy-sticky__name {
    min-width: 0;
    overflow: hidden;
    color: var(--hd-text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hd-buy-sticky__price {
    color: var(--hd-text);
    font-family: var(--hd-font-head, system-ui, sans-serif);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
  }

  /*
   * The gross-price note is right above in the summary, where there is room for it; repeating
   * it here would push the amount off a 360px screen.
   */
  .hd-buy-sticky__price .woocommerce-price-suffix {
    display: none;
  }

  .hd-buy-sticky__cta {
    flex: 0 0 auto;
    min-height: 46px;
    white-space: nowrap;
  }

  /* Room at the end of the page so the bar never covers the last thing on it. */
  body.hd-has-buy-sticky {
    padding-bottom: 5.5rem;
  }
}

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

/* ------------------------------------------------------------------ *
 * 15. Stock availability
 *
 * WooCommerce paints "w magazynie" in #0f834d, which lands at 4.49:1 on our
 * warm background - one hundredth short of AA, and Lighthouse rightly fails
 * it. The palette already carries a success colour that clears the bar at
 * 5.9:1, so the message keeps its meaning and becomes readable. (A lamp that
 * is simply in stock shows no line at all now; out of stock and backorder do.)
 * ------------------------------------------------------------------ */

.woocommerce div.product p.stock.in-stock,
.woocommerce div.product .stock.in-stock {
  color: var(--hd-success);
}

.woocommerce div.product p.stock.out-of-stock,
.woocommerce div.product .stock.out-of-stock {
  color: var(--hd-error);
}

/* Each unit has its own optional engraving; empty units carry no surcharge. */
.hd-personalization__units { display: grid; gap: 18px; margin-block: 16px; }
.hd-name-unit { min-width: 0; }
.hd-name-unit[hidden] { display: none; }
.hd-personalization__charge { margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--hd-accent-dark); }
.hd-personalization__charge:empty { display: none; }
/* The standard one/two/three selection remains usable without JavaScript. */
form.cart:has([name="hd_quantity_choice"][value="1"]:checked) [data-hd-name-unit]:not([data-hd-name-unit="1"]),
form.cart:has([name="hd_quantity_choice"][value="2"]:checked) [data-hd-name-unit="3"] { display: none; }
