/* ==========================================================================
   OstuGrupp — Single product enrichments (single.css)
   Layered on top of woocommerce.css. Uses the shared design tokens.
   Stock badge · info accordion · share buttons · refined meta · related rail.
   ========================================================================== */

/* ---- Breadcrumb spacing (premium air around it) ---- */
.single-product .woocommerce-breadcrumb {
  margin-top: 4px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* ---- Summary column rhythm (premium breathing room) ----
   The owner felt the summary was cramped ("things too compressed"). Give it an
   intentional vertical rhythm: a comfortable base gap between blocks, then a
   clear hierarchy with extra air around the price and the add-to-cart row. The
   gallery is sticky (woocommerce.css), so a taller summary no longer risks a
   void — whitespace here reads as high-end, not empty. */
.single-product .summary.entry-summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
/* Breathing room (owner: "tekst ja asjad liiga vasakul, kokku surutud").
   On desktop the summary sits in the right grid cell; on SHORT-summary products
   its content can feel jammed to the left edge. Give the whole column a small,
   intentional left/right inset and lift it off the gallery so nothing reads as
   cramped or left-shifted. The padding is desktop-only (mobile resets it to
   full-width below) and never touches the sticky gallery column. */
@media (min-width: 900px) {
  .single-product .summary.entry-summary {
    padding-left: 8px;
    padding-right: 4px;
  }
}
@media (min-width: 1200px) {
  .single-product .summary.entry-summary {
    padding-left: 14px;
    padding-right: 8px;
  }
}
.single-product .summary > * { margin-top: 0; }
.single-product .summary .product_title { margin: 0 0 16px; }
.single-product .summary .woocommerce-product-rating { margin: 0 0 18px; }
.single-product .summary .price { margin: 0 0 8px; }
.single-product .summary .woocommerce-product-details__short-description { margin: 16px 0 4px; color: var(--slate-600); line-height: 1.7; }
.single-product .summary form.cart { margin: 28px 0; }
/* The stock badge sits just above the price with clear separation. */
.single-product .summary .ostu-stock-badge { margin: 0 0 14px; }

/* ==========================================================================
   Premium BUY-BOX — the price → savings → delivery → qty+add-to-cart → trust
   block is wrapped (inc/single-product.php) in .ostu-buybox and presented as ONE
   elevated card so the purchase reads as a single deliberate panel instead of
   loose stacked rows. This is the core of the premium single-product redesign.
   ========================================================================== */
.single-product .summary .ostu-buybox {
  margin: 22px 0 0;
  padding: 22px 24px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 28px -18px rgba(15, 23, 42, .22);
}
.single-product .summary .ostu-buybox > :first-child { margin-top: 0; }
.single-product .summary .ostu-buybox > :last-child { margin-bottom: 0; }
/* Inside the card: tighten the stacked rhythm so the panel feels composed. */
.single-product .summary .ostu-buybox .ostu-status-row { margin: 0 0 12px; }
.single-product .summary .ostu-buybox .ostu-status-row .ostu-stock-badge { margin: 0; }
.single-product .summary .ostu-buybox .price { margin: 0 0 4px; }
.single-product .summary .ostu-buybox form.cart { margin: 20px 0 0; }
.single-product .summary .ostu-buybox .product-trust { margin: 20px 0 0; }

/* Savings pill under the price — clear premium discount signal on sale items. */
.single-product .ostu-savings { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 2px 0 0; }
.single-product .ostu-savings__pct {
  background: var(--green); color: #fff; font-weight: 800; font-size: 13px;
  padding: 4px 11px; border-radius: 999px; letter-spacing: .02em; line-height: 1.5;
}
.single-product .ostu-savings__amt { color: var(--green-dark); font-weight: 700; font-size: 14px; }

/* ---- Key specs + "Sobib: <X>" compatibility, surfaced high in the buy-box ----
   The compatibility banner is the #1 purchase signal for tool-system parts
   ("Sobib Makita 18V"); the compact list lifts the few decision-driving specs
   out of the Additional-information tab below the fold. */
.single-product .ostu-keyspecs { margin: 16px 0 0; }
.single-product .ostu-compat {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  background: rgba(4, 120, 87, .07);
  border: 1px solid rgba(4, 120, 87, .22);
  border-radius: var(--radius);
  color: var(--green-dark);
  font-size: 14px; line-height: 1.45;
}
.single-product .ostu-compat__icon { display: inline-flex; flex: none; color: var(--green); }
.single-product .ostu-compat__icon svg { width: 18px; height: 18px; }
.single-product .ostu-compat__text strong { font-weight: 800; color: var(--green-dark); }
.single-product .ostu-keyspecs__list { margin: 12px 0 0; }
.single-product .ostu-keyspecs__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 7px 0; border-bottom: 1px dashed var(--border);
}
.single-product .ostu-keyspecs__row:last-child { border-bottom: 0; }
.single-product .ostu-keyspecs__dt { flex: 0 1 auto; min-width: 0; color: var(--slate-500); font-size: 13.5px; font-weight: 600; }
.single-product .ostu-keyspecs__dd { margin: 0; text-align: right; color: var(--slate-dark); font-size: 13.5px; font-weight: 700; }
/* Phones: the label/value row is side-by-side, which collapses into two narrow
   ragged columns with real Estonian values like
   "7; 0°/15°/25°/40° Roostevabast Terasest Otsikud + Vahtotsik". Stack them. */
@media (max-width: 600px) {
  .single-product .ostu-keyspecs__row { display: block; padding: 9px 0; }
  .single-product .ostu-keyspecs__dt { display: block; font-size: 12.5px; font-weight: 600; }
  .single-product .ostu-keyspecs__dd { display: block; text-align: left; margin-top: 2px; font-size: 14px; }
}

/* ---- Out-of-stock alternatives (inc/oos-alternatives.php, summary priority 29) ---- */
.single-product .ostu-oos-alt { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.single-product .ostu-oos-alt__title {
  margin: 0 0 10px; font-family: var(--font-display, 'Space Grotesk'), sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--green-dark);
}
.single-product .ostu-oos-alt__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.single-product .ostu-oos-alt__link {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 8px; border-radius: var(--radius); text-decoration: none;
  transition: background .16s ease;
}
.single-product .ostu-oos-alt__link:hover { background: var(--muted); }
.single-product .ostu-oos-alt__link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.single-product .ostu-oos-alt__media {
  flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden;
  background: var(--muted); display: flex; align-items: center; justify-content: center;
}
.single-product .ostu-oos-alt__media img { width: 100%; height: 100%; object-fit: contain; }
.single-product .ostu-oos-alt__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.single-product .ostu-oos-alt__name {
  font-size: 13.5px; font-weight: 600; color: var(--slate-dark); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.single-product .ostu-oos-alt__price { font-size: 14px; font-weight: 700; color: var(--green-dark); }
.single-product .ostu-oos-alt__price del { font-weight: 500; color: var(--slate-500); margin-right: 5px; }
.single-product .ostu-oos-alt__price ins { text-decoration: none; }

/* ---- "Küsi selle toote kohta" (inc/single-product.php, summary priority 35) ---- */
.single-product .ostu-ask { margin: 14px 0 0; }
.single-product .ostu-ask__link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--slate-600); font-size: 14px; font-weight: 600; text-decoration: none;
  transition: color .16s ease;
}
.single-product .ostu-ask__link:hover { color: var(--green-dark); }
.single-product .ostu-ask__link:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 6px; }
.single-product .ostu-ask__link svg { flex: none; color: var(--green); }
.single-product .ostu-ask__text { border-bottom: 1px solid rgba(4, 120, 87, .28); }

/* Brand-align the importer's green check in the short description / sections:
   it renders #16a34a, one shade off the theme's #047857. Colour only — the list
   itself is already styled by the importer stylesheet. */
.single-product .summary .vevor-v8-check li::before,
.single-product .ostu-psec__body .vevor-v8-check li::before { color: var(--green) !important; }

/* ---- Stock badge (above the price) ---- */
.ostu-stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 6px 12px 6px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  margin: 0 0 14px;
  text-transform: none;
}
.ostu-stock-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .04);
}
.ostu-stock-badge--in {
  background: rgba(4, 120, 87, .10);
  color: var(--green-dark);
  border-color: rgba(4, 120, 87, .22);
}
.ostu-stock-badge--in .ostu-stock-badge__dot { background: var(--green); box-shadow: 0 0 0 3px rgba(4, 120, 87, .15); }
.ostu-stock-badge--low {
  background: rgba(245, 158, 11, .12);
  color: #b45309;
  border-color: rgba(245, 158, 11, .3);
}
.ostu-stock-badge--low .ostu-stock-badge__dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
/* OUT OF STOCK — red + a soft pulse to grab attention (owner request). The pulse
   is gentle ("natukene"), and prefers-reduced-motion disables it (main.css).
   Three beats, not infinite: WCAG 2.2.2 expects automatic motion lasting over five
   seconds to be stoppable, and a badge that blinks forever beside the price reads
   as an error rather than information. The attention-grab still happens — the page
   just settles afterwards. */
.ostu-stock-badge--out {
  background: rgba(239, 68, 68, .12);
  color: var(--danger-dark);
  border-color: rgba(239, 68, 68, .42);
  animation: ostu-stock-pulse 1.5s ease-in-out 3;
}
.ostu-stock-badge--out .ostu-stock-badge__dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
@keyframes ostu-stock-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* Status row — stock badge + "Soodus" badge grouped on one line at the top of the
   buy-box, so the sale and stock state read together (instead of the sale flash
   living separately over on the gallery). */
.single-product .ostu-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.single-product .ostu-status-row .ostu-stock-badge { margin: 0; }
.ostu-sale-badge {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 800;
  letter-spacing: .02em; padding: 6px 12px; border-radius: 999px;
  background: var(--green); color: #fff;
}

/* The "Soodus" now lives in the buy-box status row, so drop the duplicate sale
   flash pinned on the single-product gallery. */
.single-product .woocommerce-product-gallery .onsale,
.single-product div.product > .onsale,
.single-product div.product > span.onsale { display: none !important; }

/* Hide WooCommerce's default text stock line — the badge replaces it. */
.single-product .stock { display: none; }

/* ---- Info accordion (Tarne · Tagastus · Garantii) ---- */
.ostu-info-accordion {
  margin: 28px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-card);
}
.ostu-acc { border-top: 1px solid var(--border); }
.ostu-acc:first-child { border-top: 0; }
.ostu-acc__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--slate-dark);
  transition: background .2s ease;
  user-select: none;
}
.ostu-acc__head::-webkit-details-marker { display: none; }
.ostu-acc__head:hover { background: var(--muted); }
.ostu-acc__icon { font-size: 18px; line-height: 1; flex: none; }
.ostu-acc__title { flex: 1; }
.ostu-acc__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--slate-500);
  border-bottom: 2px solid var(--slate-500);
  transform: rotate(45deg);
  transition: transform .25s ease;
  flex: none;
  margin-right: 4px;
}
.ostu-acc[open] .ostu-acc__chevron { transform: rotate(-135deg); }
.ostu-acc__body {
  padding: 0 18px 18px 48px;
  color: var(--slate-600);
  font-size: 14px;
  line-height: 1.7;
}
.ostu-acc__body p { margin: 0 0 8px; }
.ostu-acc__list { margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.ostu-acc__list li { position: relative; padding-left: 20px; }
.ostu-acc__list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green);
  font-weight: 800;
}

/* ---- Refined product meta (SKU / kategooriad) ---- */
.single-product .product_meta {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--slate-600);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.single-product .product_meta > span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.single-product .product_meta .sku_wrapper,
.single-product .product_meta .posted_in,
.single-product .product_meta .tagged_as {
  font-weight: 500;
}
.single-product .product_meta .sku,
.single-product .product_meta a {
  color: var(--slate-dark);
  font-weight: 600;
}
.single-product .product_meta a:hover { color: var(--green); }

/* ---- Share buttons ---- */
.ostu-share {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ostu-share__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ostu-share__links { display: flex; gap: 8px; flex-wrap: wrap; }
.ostu-share__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--slate);
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.ostu-share__btn:hover { transform: translateY(-2px); color: #fff; }
.ostu-share__btn--facebook:hover { background: #1877f2; border-color: #1877f2; }
.ostu-share__btn--twitter:hover { background: #0f172a; border-color: #0f172a; }
.ostu-share__btn--whatsapp:hover { background: #25d366; border-color: #25d366; }
.ostu-share__btn--email:hover { background: var(--green); border-color: var(--green); }
.ostu-share__btn svg { display: block; }

/* ---- Related products rail (premium) ---- */
.related.products {
  margin-top: 0;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}
.related.products > h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 28px);
  margin-bottom: 6px;
}
.related.products::before {
  /* Was "Käsitsi valitud sulle" — but this rail is WooCommerce's automatic
     same-category/tag query, nobody hand-picks it. Invariant #3: no false claims. */
  content: "Samast kategooriast";
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--green);
  margin-bottom: 8px;
}
.related.products > h2 { margin-top: 0; }
.related.products ul.products { margin-top: 22px; }

/* ---- Upsells rail: same divider treatment as the related rail ---- */
.upsells.products { margin-top: 0; padding-top: 48px; border-top: 1px solid var(--border); }
.upsells.products > h2 { margin-top: 0; }

/* Keep the related rail full-width inside the product grid layout. */
@media (min-width: 900px) {
  .single-product div.product > .related.products,
  .single-product div.product > .upsells.products,
  .single-product div.product > .woocommerce-tabs {
    grid-column: 1 / -1;
  }
}

/* NB: the sticky gallery rule lives in woocommerce.css (next to the other gallery
   rules) and needs a very specific selector to beat a plugin's own
   position:relative — see the comment there. A duplicate lived here in v1.2.53 at
   too low a specificity and never took effect; removed so there is one source. */

/* ==========================================================================
   MOBILE — single product enrichments (owner: "kõik peab mobiilis ilus olema!!!")
   Phones (<=768px) and small phones (<=480px). The summary column already
   stacks full-width via the mobile-first grid in woocommerce.css; here we tune
   the enrichment blocks (stock badge, accordion, meta, share, related label)
   so they read clean and roomy — never cramped — on narrow screens.
   ========================================================================== */
@media (max-width: 768px) {
  /* Breadcrumb keeps premium air but a touch tighter on phones. Measured on a
     375px phone the 5-level trail (Avaleht/Pood/Aiakaubad/Survepesurid/
     Teleskoopvarred) wrapped to 3 lines = 124px of the 812px viewport before any
     product pixel. One scrollable line instead, links kept tappable. */
  .single-product .woocommerce-breadcrumb {
    margin-bottom: 20px; padding-bottom: 14px;
    display: flex; flex-wrap: nowrap; align-items: center;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; white-space: nowrap;
  }
  .single-product .woocommerce-breadcrumb::-webkit-scrollbar { display: none; }
  .single-product .woocommerce-breadcrumb a { padding: 6px 4px; }

  /* The header trust bar repeats the Tarne/Tagastus/Garantii accordion word for
     word ~1500px further down, and costs another 89px above the fold. Keep it
     everywhere else; hide it on the one template that already says all three. */
  .single-product .trust-bar { display: none; }

  /* Buy first: price + action above the pitch.
     The short description is deliberately lifted to summary priority 7 for the
     DESKTOP two-column layout (inc/single-product.php:102) — on a phone that same
     block is 228px tall and pushes the price down. Reorder with flex `order`
     (the summary is already display:flex/column, verified) rather than changing
     the hook, so desktop is untouched. Unlisted children fall in at 5. */
  .single-product .summary.entry-summary > * { order: 5; }
  .single-product .summary .product_title { order: 1; }
  .single-product .summary .ostu-buybox { order: 2; }
  .single-product .summary .woocommerce-product-details__short-description { order: 3; }
  .single-product .summary .ostu-info-accordion { order: 4; }
  .single-product .summary .ostu-cmp-single { order: 6; }
  .single-product .summary .product_meta { order: 7; }

  /* Tap targets — measured below the 44px minimum on a 375px phone. */
  .single-product .product_meta a { display: inline-block; padding: 5px 0; line-height: 1.9; }

  /* Summary: drop the desktop inset so blocks run edge-to-edge full-width. */
  .single-product .summary.entry-summary { padding-left: 0; padding-right: 0; }

  /* Tighten the vertical rhythm a little so the buy block stays above the fold,
     while still feeling airy (not the compressed look the owner disliked). */
  .single-product .summary .product_title { margin-bottom: 12px; }
  .single-product .summary .woocommerce-product-rating { margin-bottom: 14px; }
  .single-product .summary .woocommerce-product-details__short-description { margin: 16px 0 4px; }
  .single-product .summary form.cart { margin: 22px 0; }

  /* Stock badge stays comfortably tappable-sized, full pill. */
  .ostu-stock-badge { font-size: 12.5px; padding: 6px 12px; }

  /* Info accordion — full-width card, generous tap targets (>=44px heads),
     body indent reduced so copy isn't pushed into a narrow gutter. */
  .ostu-info-accordion { margin: 24px 0 4px; }
  .ostu-acc__head { padding: 15px 16px; min-height: 44px; box-sizing: border-box; font-size: 14.5px; }
  .ostu-acc__body { padding: 0 16px 16px 42px; font-size: 13.5px; }

  /* Product meta wraps cleanly. */
  .single-product .product_meta { margin-top: 20px; padding-top: 16px; font-size: 13px; }

  /* Share row stays a tidy wrap of 40px tap targets. */
  .ostu-share { gap: 10px; margin-top: 14px; padding-top: 14px; }

  /* Related rail label + heading scale down. */
  .related.products { margin-top: 0; padding-top: 36px; }
  .related.products ul.products { margin-top: 18px; }
}

@media (max-width: 480px) {
  /* On the smallest phones the accordion body indent eats too much width — pull
     it back near the edge so the delivery/return/warranty copy stays readable. */
  .ostu-acc__head { gap: 10px; padding: 14px 14px; }
  .ostu-acc__body { padding: 0 14px 14px 38px; }
  .ostu-acc__list li { padding-left: 18px; }

  /* Share buttons full 44px touch targets on tiny screens. */
  .ostu-share__btn { width: 44px; height: 44px; }
}
