/* ==========================================================================
   Nevoura — Product Page Redesign v5 ("App Card" layout)
   Mobile-first. Base rules = phone/app layout (simple stacked flow).
   Desktop (>= 960px) layers on a 2-column grid with a black rounded
   "card" panel behind the gallery/thumbnails/options/meta, achieved
   entirely with CSS Grid placement + a grid-area-positioned ::before
   (no template overrides — same default WooCommerce markup as before:
   form.variations_form.cart > table.variations + .single_variation_wrap).

   Key structural decision vs v4: the variations FORM itself is now the
   white "options card" box (not flattened via display:contents), so its
   two real children — table.variations (Tier/Theme/Date) and
   .single_variation_wrap (Total price + Add to cart) — simply stack
   inside it in normal document flow. Only .woocommerce-product-gallery
   and .summary.entry-summary are flattened, so the image, thumbnails,
   eyebrow, title, price, the options-card, and the meta box can each be
   placed independently on the grid.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap");

.single-product div.product,
.single-product div.product * {
  box-sizing: border-box;
}

.single-product div.product {
  --nv-pp-ink:      #0c0c0c;
  --nv-pp-mid:      #3a3a3a;
  --nv-pp-muted:    #8a8a8a;
  --nv-pp-border:   #e3e3e3;
  --nv-pp-border-soft: #ececec;
  --nv-pp-surface:  #f7f6f4;
  --nv-pp-accent:   var(--nv-accent, #d7fe03);
  --nv-pp-danger:   #c0392b;
  --nv-pp-radius:   20px;
  --nv-pp-radius-sm: 12px;
  --nv-pp-card-radius: 28px;
  --nv-pp-card-bg: #e7e7e4;

  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  position: relative;
  max-width: 1280px;
  margin: 0 auto 64px !important;
  padding: 0 0 24px;
  color: var(--nv-pp-ink);
}

/* ==========================================================================
   BASE / MOBILE (app-first) — plain stacked flow in natural DOM order:
   image -> thumbnails -> eyebrow -> title -> short description -> price
   -> options card (table + variation/cart) -> meta box -> tabs.
   ========================================================================== */

/* ---------- Gallery image ---------- */
.single-product div.product .woocommerce-product-gallery__wrapper {
  border-radius: var(--nv-pp-radius);
  overflow: hidden;
  background: #e6e6e4;
  position: relative;
  margin: 0 16px 12px;
}
.single-product div.product .woocommerce-product-gallery__wrapper img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 5;
}
.single-product div.product .woocommerce-product-gallery__trigger {
  display: none; /* avoid a stray zoom icon */
}

/* ---------- Thumbnails ---------- */
.single-product div.product .flex-control-thumbs {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin: 0 0 24px !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.single-product div.product .flex-control-thumbs::-webkit-scrollbar { display: none; }
.single-product div.product .flex-control-thumbs li {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}
.single-product div.product .flex-control-thumbs li img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  border: 1.5px solid var(--nv-pp-border);
  opacity: .55;
  transition: opacity .15s ease, border-color .15s ease;
  cursor: pointer;
}
.single-product div.product .flex-control-thumbs li img.flex-active,
.single-product div.product .flex-control-thumbs li img:hover {
  opacity: 1;
  border-color: var(--nv-pp-ink);
}

/* ---------- Header block: eyebrow / title / short desc / price ---------- */
.single-product div.product .summary.entry-summary > .posted_in:first-of-type,
.single-product div.product p.posted_in a.nv-pp-eyebrow {
  display: block;
  font-size: 11px !important;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--nv-pp-muted) !important;
  background: none !important;
  padding: 0 !important;
  margin: 0 16px 8px !important;
  text-decoration: none !important;
}

.single-product div.product .product_title {
  font-family: inherit !important;
  font-weight: 800 !important;
  font-size: clamp(28px, 7vw, 40px) !important;
  line-height: 1.04 !important;
  letter-spacing: -.01em !important;
  text-transform: uppercase;
  color: var(--nv-pp-ink) !important;
  margin: 0 16px 10px !important;
}

.single-product div.product .woocommerce-product-details__short-description {
  color: var(--nv-pp-mid);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 16px 14px !important;
}

/* Starting-from price range shown before a variation resolves */
.single-product div.product > .summary p.price {
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--nv-pp-muted) !important;
  margin: 0 16px 20px !important;
}

/* ---------- Options card: the real variations form ---------- */
.single-product div.product .summary.entry-summary > form.cart.variations_form {
  display: block;
  background: #fff;
  border: 1px solid var(--nv-pp-border-soft);
  border-radius: var(--nv-pp-radius);
  padding: 16px 16px 14px;
  margin: 0 16px 12px;
  box-shadow: 0 10px 30px -14px rgba(12, 12, 12, .18);
}

.single-product div.product table.variations::before {
  content: "Customize";
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--nv-pp-muted);
  margin-bottom: 8px;
}

.single-product div.product table.variations,
.single-product div.product table.variations tbody {
  display: block;
  width: 100%;
  border: none;
  background: none;
}

.single-product div.product table.variations {
  margin: 0 0 18px !important;
}

/* Each field (Tier / Theme / Event date) is its own separate rounded
   "pill" row — not one shared bordered table — matching the reference. */
.single-product div.product table.variations tr {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  border: none;
  background: var(--nv-pp-surface);
  border-radius: var(--nv-pp-radius-sm);
  padding: 13px 16px !important;
  margin: 0 0 8px !important;
  gap: 4px 12px;
}
.single-product div.product table.variations tr:last-child {
  margin-bottom: 0 !important;
}

.single-product div.product table.variations tr .label,
.single-product div.product table.variations tr .label label {
  display: block;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--nv-pp-muted);
  margin: 0 !important;
}

.single-product div.product table.variations tr .value {
  flex: 1 1 auto;
  min-width: 0;
}

/* Cross-browser safety net: some theme/table CSS forces th/td back to
   display:table-cell with !important, which stops them from becoming
   proper flex items (a long-standing WebKit table-cell-in-flex bug).
   Forcing block here makes the flexify behave consistently everywhere. */
.single-product div.product table.variations tr > th,
.single-product div.product table.variations tr > td,
.single-product div.product table.variations tr .label,
.single-product div.product table.variations tr .value {
  display: block !important;
  vertical-align: middle !important;
  text-align: left;
}

/* If the short description is empty, WooCommerce still prints an empty
   wrapper — drop it completely so it can't add a stray gap. */
.single-product div.product .woocommerce-product-details__short-description:empty {
  display: none !important;
}

.single-product div.product table.variations select,
.single-product div.product table.variations input[type="date"],
.single-product div.product table.variations input[type="text"] {
  width: 100%;
  padding: 0 24px 0 0;
  border: none;
  background: transparent;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--nv-pp-ink);
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* Small "checkbox" style indicator to the right of each field, matching
   the boxed-check affordance in the reference design. */
.single-product div.product table.variations select,
.single-product div.product table.variations input[type="text"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='2' y='2' width='16' height='16' rx='4' stroke='%230c0c0c' stroke-width='1.6'/%3E%3Cpath d='M6 10.3l2.4 2.4L14 7.4' stroke='%230c0c0c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.single-product div.product table.variations input[type="date"] { padding-right: 0; text-align: right; }
.single-product div.product table.variations input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }

.single-product div.product table.variations tr:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--nv-pp-ink);
}

.single-product div.product table.variations .nevoura-date-hint {
  display: block;
  width: 100%;
  font-size: 11.5px !important;
  color: var(--nv-pp-muted) !important;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  text-align: left;
  line-height: 1.4;
}
.single-product div.product table.variations .nevoura-date-error td,
.single-product div.product table.variations .nevoura-theme-error td {
  font-size: 12px !important;
  color: var(--nv-pp-danger) !important;
  padding: 2px 0 0 !important;
  border: none !important;
  text-align: right;
}

/* ---------- Total price (once a variation resolves) ---------- */
.single-product div.product .woocommerce-variation.single_variation {
  min-height: 1px; /* avoid a layout jump before JS populates it */
}
.single-product div.product .woocommerce-variation-price {
  position: relative;
  margin: 0 0 12px !important;
  padding-top: 16px;
}
.single-product div.product .woocommerce-variation-price .price {
  font-family: inherit !important;
  font-size: 30px !important;
  font-weight: 800 !important;
  color: var(--nv-pp-ink) !important;
}
.single-product div.product .woocommerce-variation-price .price::before {
  content: "Total";
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--nv-pp-muted);
}
.single-product div.product .woocommerce-variation-price .price del { color: var(--nv-pp-muted) !important; opacity: 1 !important; font-weight: 500 !important; font-size: 16px !important; }
.single-product div.product .woocommerce-variation-price .price ins { text-decoration: none; }
.single-product div.product .woocommerce-variation-description { font-size: 13px; color: var(--nv-pp-muted); margin: 0 0 12px !important; }

/* ---------- Quantity + Add to cart row ---------- */
.single-product div.product .woocommerce-variation-add-to-cart {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

.single-product div.product .quantity {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--nv-pp-ink);
  border-radius: var(--nv-pp-radius-sm);
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}
.single-product div.product .quantity .nv-qty-btn {
  width: 38px;
  border: none;
  background: transparent;
  color: var(--nv-pp-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.single-product div.product .quantity .nv-qty-btn:hover { background: var(--nv-pp-surface); }
.single-product div.product .quantity .qty {
  width: 36px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--nv-pp-border);
  border-right: 1px solid var(--nv-pp-border);
  padding: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--nv-pp-ink);
  background: transparent;
  -moz-appearance: textfield;
}
.single-product div.product .quantity .qty::-webkit-inner-spin-button,
.single-product div.product .quantity .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.single-product div.product .single_add_to_cart_button,
.single-product div.product button.single_add_to_cart_button.alt {
  font-family: inherit !important;
  background: var(--nv-pp-accent) !important;
  color: var(--nv-pp-ink) !important;
  border: 1.5px solid var(--nv-pp-ink) !important;
  border-radius: var(--nv-pp-radius-sm) !important;
  padding: 0 28px !important;
  height: auto !important;
  min-height: 48px;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase !important;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .15s ease;
  flex: 1 1 auto;
}
.single-product div.product .single_add_to_cart_button:hover { background: #fff !important; }
.single-product div.product .single_add_to_cart_button:active { transform: scale(.98); }
.single-product div.product .single_add_to_cart_button.disabled,
.single-product div.product .single_add_to_cart_button.wc-variation-selection-needed {
  background: var(--nv-pp-border) !important;
  border-color: var(--nv-pp-border) !important;
  color: #a3a3a3 !important;
  cursor: not-allowed;
}

/* "Clear" reset link — restyled as a small dark pill. It's relocated by
   product-page.js into the Tier row's value cell; display:flex (not
   inline-flex) makes it a block-level box so it naturally drops to its
   own line under the select, rather than sitting inline beside it.
   Everything is !important because WooCommerce/theme button CSS
   (.button, a.button, etc.) tends to carry higher specificity and was
   inflating this into a full-size button otherwise. */
.single-product div.product a.reset_variations {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: fit-content !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 8px 0 0 !important;
  padding: 6px 14px !important;
  background: var(--nv-pp-ink) !important;
  color: #fff !important;
  font-size: 10.5px !important;
  line-height: 1.4 !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase !important;
  text-decoration: none !important;
  border: none !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

/* ---------- Specs box (SKU / category) — lime panel ---------- */
.single-product div.product .product_meta {
  display: block;
  margin: 0 16px 12px;
  padding: 16px 18px;
  background: var(--nv-pp-accent);
  border-radius: var(--nv-pp-radius);
  font-size: 12.5px !important;
  color: var(--nv-pp-ink) !important;
}
.single-product div.product .product_meta > span {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.single-product div.product .product_meta > span:not(:last-child) { border-bottom: 1px solid rgba(12,12,12,.12); }
.single-product div.product .product_meta a { color: var(--nv-pp-ink) !important; font-weight: 700; text-transform: none; letter-spacing: 0; }

/* ---------- Sticky mobile "Add to cart" bar ---------- */
.nv-pp-sticky-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--nv-pp-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .06);
  transform: translateY(100%);
  transition: transform .25s ease;
  font-family: "DM Sans", -apple-system, sans-serif;
}
.nv-pp-sticky-bar.nv-pp-sticky-visible { transform: translateY(0); }
.nv-pp-sticky-bar .nv-pp-sticky-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--nv-pp-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nv-pp-sticky-bar .nv-pp-sticky-cta {
  flex: 1 1 auto;
  max-width: 220px;
  background: var(--nv-pp-accent);
  color: var(--nv-pp-ink);
  border: 1.5px solid var(--nv-pp-ink);
  border-radius: 10px;
  height: 46px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-family: inherit;
  cursor: pointer;
}
.nv-pp-sticky-bar .nv-pp-sticky-cta:disabled {
  background: var(--nv-pp-border);
  border-color: var(--nv-pp-border);
  color: #a3a3a3;
  cursor: not-allowed;
}

/* ---------- Tabs → "Theme Features" section ---------- */
.single-product div.product .woocommerce-tabs {
  margin: 44px 16px 0;
  max-width: 780px;
}
.single-product div.product .woocommerce-tabs ul.tabs,
.single-product div.product .woocommerce-tabs ul.wc-tabs {
  display: none !important;
}
.single-product div.product .woocommerce-tabs .woocommerce-Tabs-panel {
  display: block !important;
}
.single-product div.product .woocommerce-tabs #tab-additional_information,
.single-product div.product .woocommerce-tabs #tab-reviews {
  display: none !important;
}
.single-product div.product .woocommerce-tabs .panel > h2 {
  display: none;
}
.single-product div.product .woocommerce-tabs #tab-description::before {
  content: "Theme Features";
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--nv-pp-muted);
  margin-bottom: 18px;
}
.single-product div.product .woocommerce-tabs .panel p,
.single-product div.product .woocommerce-tabs .panel table {
  color: var(--nv-pp-mid);
  font-size: 15px;
  line-height: 1.75;
  margin: 0 0 18px !important;
}

@media (max-width: 480px) {
  .single-product div.product .woocommerce-variation-price .price { font-size: 26px !important; }
}

/* ==========================================================================
   DESKTOP / TABLET (>= 960px): 2-column grid with a black rounded "card"
   panel positioned behind the gallery bottom / options card / thumbnails
   / meta box, using an inset ::before placed on the same grid rows.
   ========================================================================== */
@media (min-width: 960px) {
  .single-product div.product {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 320px;
    /* 6 explicit rows: eyebrow / title / short-desc / price / options-card / thumbs+meta.
       row-gap is intentionally 0 — vertical rhythm between header lines is
       controlled with real margins below instead, so an empty row (e.g. no
       short description) can never inject a stray gap. */
    grid-template-rows: auto auto auto auto auto auto;
    column-gap: 44px;
    row-gap: 0;
    align-items: start;
    padding: 40px 32px 0;
    isolation: isolate; /* keep the ::before card behind real z-index:1 content */
  }

  /* Card panel: spans the options-card row + the thumbs/meta row, full
     width, inset beyond the grid area for visible padding on every side.
     Sized purely from those two rows' real content — independent of the
     image, which is handled separately below. Light grey per request
     (was solid black). */
  .single-product div.product::before {
    content: "";
    grid-column: 1 / -1;
    grid-row: 5 / 7;
    position: absolute;
    inset: -20px -24px -24px;
    background: var(--nv-pp-card-bg);
    border-radius: var(--nv-pp-card-radius);
    z-index: 0;
  }

  /* Lift nested wrappers so their real children become direct grid items */
  .single-product div.product .woocommerce-product-gallery,
  .single-product div.product .summary.entry-summary {
    display: contents;
  }

  /* -- column 1: image (rows 1–5). Its height needs to match column 2's
     natural content height (header + options card) without letting the
     image's own portrait aspect-ratio drive that height (which caused a
     big gap bug). A pure-CSS "stretch, then absolutely-fill" trick can
     do this, but it depends on containing-block/clip edge cases that
     didn't render reliably everywhere — so this is measured with a
     small bit of JS instead (see product-page.js: syncGalleryHeight).
     The image stays in normal flow the whole time, so it always renders;
     --nv-img-h is just a CSS variable JS updates on load/resize. -- */
  .single-product div.product .woocommerce-product-gallery__wrapper {
    grid-column: 1;
    grid-row: 1 / 6;
    margin: 0;
    position: relative;
    z-index: 1;
    align-self: start;
    height: var(--nv-img-h, 560px);
  }
  .single-product div.product .woocommerce-product-gallery__wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: auto;
  }

  .single-product div.product .flex-control-thumbs {
    grid-column: 1;
    grid-row: 6;
    align-self: start;
    padding: 0;
    margin: 16px 0 0 !important;
    position: relative;
    z-index: 1;
  }
  .single-product div.product .flex-control-thumbs li {
    width: calc(25% - 6px);
    aspect-ratio: 1;
    height: auto;
  }

  /* -- column 2, rows 1–4: eyebrow / title / short-desc / price header,
     spacing controlled by margins so an empty short-description can't
     leave a gap behind it. -- */
  .single-product div.product .summary.entry-summary > .posted_in:first-of-type,
  .single-product div.product p.posted_in a.nv-pp-eyebrow {
    grid-column: 2; grid-row: 1;
    margin: 0 0 8px !important;
  }
  .single-product div.product .product_title {
    grid-column: 2; grid-row: 2;
    margin: 0 0 10px !important;
  }
  .single-product div.product .woocommerce-product-details__short-description {
    grid-column: 2; grid-row: 3;
    margin: 0 0 12px !important;
  }
  .single-product div.product > .summary p.price {
    grid-column: 2; grid-row: 4;
    margin: 0 0 18px !important;
  }

  /* -- column 2, row 5: the options card (the real form) -- */
  .single-product div.product .summary.entry-summary > form.cart.variations_form {
    grid-column: 2;
    grid-row: 5;
    margin: 0;
    position: relative;
    z-index: 1;
    align-self: start;
  }

  /* -- column 2, row 6: lime meta box, aligned with thumbnails -- */
  .single-product div.product .product_meta {
    grid-column: 2;
    grid-row: 6;
    margin: 16px 0 0;
    align-self: start;
    position: relative;
    z-index: 1;
  }

  /* -- full width: tabs / Theme Features section -- */
  .single-product div.product .woocommerce-tabs {
    grid-column: 1 / -1;
    grid-row: 7;
    margin: 68px 0 0;
    max-width: 780px;
  }

  .single-product div.product .product_title {
    font-size: clamp(34px, 3.2vw, 46px) !important;
  }

  .nv-pp-sticky-bar { display: none !important; }
}
