/* ============================================================
   Produktsiden — designpakkens layout
   Selektorene starter med .woocommerce div.product.pdp for å slå både
   woocommerce.css-broen og WooCommerce sin egen CSS (float:left; width:48%
   på bildene) uten !important.
   ============================================================ */

.woocommerce div.product.pdp {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) 340px;
  grid-template-areas:
    "gallery head buy"
    "gallery info buy";
  grid-template-rows: auto 1fr;
  column-gap: 34px;
  row-gap: 14px;
  align-items: start;
  padding: 6px 0 44px;
}

.pdp .pdp-head    { grid-area: head; }
.pdp .pdp-gallery { grid-area: gallery; min-width: 0; }
.pdp .buybox      { grid-area: buy; }
.pdp .pdp-info    { grid-area: info; min-width: 0; }

/* --- Tittel og merkelapper --- */
.pdp .pdp-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.tag-ref { background: var(--surface-2); color: var(--ink-2); }
.woocommerce div.product.pdp .pdp-title {
  font-family: var(--f-display); font-size: 27px; font-weight: 600;
  line-height: 1.2; letter-spacing: -.015em; margin: 0; text-wrap: balance;
}

/* --- Galleri --- */
.woocommerce div.product.pdp div.images,
.woocommerce div.product.pdp .woocommerce-product-gallery {
  float: none; width: 100%; margin: 0; position: relative; opacity: 1 !important;
}
.pdp .woocommerce-product-gallery__wrapper { margin: 0; }
.pdp .woocommerce-product-gallery__image,
.pdp .woocommerce-product-gallery .flex-viewport {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.pdp .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image { border: 0; border-radius: 0; }
.pdp .woocommerce-product-gallery__image img { width: 100%; height: auto; display: block; margin: 0; }

.woocommerce div.product.pdp div.images .flex-control-thumbs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
  margin: 8px 0 0; padding: 0; list-style: none; overflow: visible;
}
.woocommerce div.product.pdp div.images .flex-control-thumbs li {
  width: auto; float: none; margin: 0; padding: 0;
}
.woocommerce div.product.pdp div.images .flex-control-thumbs li img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: 3px; background: var(--surface);
  opacity: .7; cursor: pointer; transition: opacity .12s, border-color .12s;
}
.woocommerce div.product.pdp div.images .flex-control-thumbs li img:hover { opacity: 1; }
.woocommerce div.product.pdp div.images .flex-control-thumbs li img.flex-active {
  opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Forstørrelsesglass for lysboks */
.pdp .woocommerce-product-gallery__trigger {
  position: absolute; top: 12px; right: 12px; z-index: 9;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-1); text-indent: -9999px; overflow: hidden;
}
.pdp .woocommerce-product-gallery__trigger::before {
  content: ""; position: absolute; left: 10px; top: 9px; width: 11px; height: 11px;
  border: 2px solid var(--ink-2); border-radius: 50%;
}
.pdp .woocommerce-product-gallery__trigger::after {
  content: ""; position: absolute; left: 21px; top: 21px; width: 2px; height: 7px;
  background: var(--ink-2); transform: rotate(-45deg); transform-origin: top;
}
.pdp .woocommerce-product-gallery__trigger:hover { border-color: var(--ink); }
.pdp.is-sold .woocommerce-product-gallery__image img { opacity: .6; }

/* --- Beskrivelse og detaljer --- */
.pdp .pdp-lead { font-size: 15px; line-height: 1.68; color: var(--ink-2); margin: 4px 0 22px; max-width: 64ch; }
.pdp .pdp-lead p { margin: 0 0 12px; }
.pdp .pdp-lead p:last-child { margin-bottom: 0; }

.pdp .specs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pdp .specs caption {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .11em;
  font-weight: 700; color: var(--ink); padding-bottom: 9px;
}
.pdp .specs th, .pdp .specs td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.pdp .specs th { font-weight: 500; color: var(--muted); width: 40%; }
.pdp .specs td { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.pdp .specs .cat-path a { color: var(--accent); text-decoration: none; }
.pdp .specs .cat-path a:hover { text-decoration: underline; }
.pdp .specs .sep { color: var(--muted); margin: 0 4px; font-weight: 400; }
.pdp .pdp-desc { margin-top: 26px; }

/* --- Kjøpsboks --- */
.woocommerce div.product.pdp .buybox {
  position: sticky; top: 112px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 20px; box-shadow: var(--shadow-1);
}
.pdp .price-big {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.pdp .price-big .amount { color: inherit; }
.pdp .price-big del { font-size: 16px; color: var(--muted); font-weight: 400; margin-right: 6px; }
.pdp .price-big ins { text-decoration: none; }
.pdp .price-big.price-gold { color: var(--brass); }
.pdp .price-big .woocommerce-price-suffix { display: block; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 4px; }

.pdp .buy-stock {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ok); margin: 12px 0 14px;
}
.pdp .buy-stock.is-out { color: var(--sold); }

/* WooCommerce sitt eget skjema: knappen fyller bredden, lagerlinjen deres skjules
   (vi har vår egen over), antallsfeltet vises bare når det finnes flere enn ett. */
.pdp .buy-form p.stock { display: none; }
.woocommerce div.product.pdp .buy-form form.cart {
  display: flex; gap: 8px; align-items: stretch; margin: 0 0 8px; flex-wrap: nowrap;
}
.woocommerce div.product.pdp .buy-form form.cart div.quantity { float: none; margin: 0; }
.woocommerce div.product.pdp .buy-form form.cart .quantity input.qty { height: 48px; }
.woocommerce div.product.pdp .buy-form form.cart .single_add_to_cart_button {
  float: none; flex: 1; width: 100%; padding: 14px 20px; font-size: 15px;
  background: var(--accent); color: #fff; border-radius: var(--r);
}
.woocommerce div.product.pdp .buy-form form.cart .single_add_to_cart_button:hover { background: var(--accent-hi); }
.woocommerce div.product.pdp .buy-form form.cart .single_add_to_cart_button.loading { opacity: .7; }

.pdp .buybox .btn-ghost { margin-top: 0; padding: 12px 18px; font-size: 13.5px; }

.pdp .assure {
  list-style: none; margin: 16px 0 0; padding: 14px 0 0;
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px;
}
.pdp .assure li { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.pdp .assure svg { flex: none; margin-top: 1px; color: var(--accent); }

/* --- Lignende objekter --- */
.single-product .related.products,
.single-product .upsells.products {
  padding-top: 32px; margin-top: 8px; border-top: 1px solid var(--line);
}
.single-product .related.products > h2,
.single-product .upsells.products > h2 {
  font-family: var(--f-display); font-size: 22px; font-weight: 600;
  letter-spacing: -.01em; margin: 0 0 16px;
}

/* --- Nettbrett: galleri til venstre, tittel og kjøpsboks til høyre, detaljer under --- */
@media (max-width: 1240px) {
  .woocommerce div.product.pdp {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "gallery head"
      "gallery buy"
      "info    info";
    grid-template-rows: auto auto auto;
  }
  .woocommerce div.product.pdp .buybox { position: static; }
  .pdp .pdp-info { margin-top: 20px; }
}

/* --- Mobil: tittel, bilde, kjøp, detaljer --- */
@media (max-width: 860px) {
  .woocommerce div.product.pdp {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "gallery" "buy" "info";
    row-gap: 16px;
  }
  .woocommerce div.product.pdp .pdp-title { font-size: 23px; }
  .woocommerce div.product.pdp div.images .flex-control-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pdp .pdp-info { margin-top: 4px; }
}
