/* STONE DETAILS table (added 2026-09-03, restyled 2026-09-03, split into two
   separate boxes 2026-09-03) — staging preview.

   When a product has more than one stone, tpl_modules_attributes.php renders
   PRODUCT DETAILS and STONE DETAILS as two separate sibling boxes
   (.productDetailsBox / .stoneDetailsBox) instead of one shared box, and
   marks the outer #productAttributes container with .hasStoneDetailsBoxes so
   its own box chrome (background/border/padding) and "Product Details"
   heading can be turned off here — leaving the two new boxes to provide all
   the visible framing. Single-stone and no-stone products never get the
   .hasStoneDetailsBoxes class, so #productAttributes keeps its normal single
   box appearance for them, completely unaffected by any of this. */

#productAttributes.hasStoneDetailsBoxes {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  /* The site's base stylesheet caps #productAttributes at max-width:520px.
     .productDetailsBox / .stoneDetailsBox need room to actually reach their
     own (wider) max-width below, or their width:100% just inherits this
     520px cap and gets clipped back down to it — override it here.
     780px was checked against the live page's available column width
     (~900px) on 2026-09-03, so the boxes have real breathing room without
     crowding the rest of the product column. */
  max-width: 780px;
}

#productAttributes.hasStoneDetailsBoxes::before {
  content: none;
}

.productDetailsBox,
.stoneDetailsBox {
  width: 100%;
  max-width: 780px;
  box-sizing: border-box;
  background: rgb(250, 250, 250);
  border: 1px solid rgb(227, 227, 227);
  border-radius: 4px;
  padding: 12px 16px;
}

.productDetailsBox {
  margin: 12px 0 20px 0;
}

.stoneDetailsBox {
  margin: 0 0 12px 0;
}

.productDetailsBoxHeading,
.stoneDetailsBoxHeading {
  margin: 0 0 10px 0;
  padding: 0 0 6px 0;
  color: rgb(8, 56, 104);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgb(197, 208, 224);
}

.stoneDetailsTable {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

/* Desktop only: table-layout:fixed makes the column-width percentages below
   authoritative, so the table can never grow wider than its box (which is
   what was pushing the Cut column outside the border) — the browser wraps
   text inside a cell instead of letting the whole table overflow. Left as
   the default "auto" on mobile, where the table is switched to block/card
   display anyway and table-layout is irrelevant. */
@media (min-width: 961px) {
  .stoneDetailsTable {
    table-layout: fixed;
  }
}

.stoneDetailsTable th,
.stoneDetailsTable td {
  border: 1px solid #d8dee3;
  padding: 8px 14px;
  text-align: left;
  vertical-align: middle;
  word-wrap: normal;
  overflow-wrap: normal;
}

/* A stone with no value for a given field gets a genuinely empty cell —
   no dash, no "N/A", no placeholder text. On mobile the cell is dropped
   from the card entirely (see :empty rule below); on desktop it stays as
   a blank cell so the table's column count/alignment stays consistent
   across rows. */

.stoneDetailsTable thead th {
  background: #eef2f6;
  color: #2f4f6f;
  font-weight: bold;
  white-space: nowrap;
}

.stoneDetailsTable tbody tr:nth-child(even) {
  background: #f8fafb;
}

.stoneDetailsTable td[data-label="Type"] {
  font-weight: 600;
  color: #1a1a1a;
}

/* Desktop column widths: give Type and Size enough room that typical values
   ("Natural Diamond" / "Lab-Grown Sapphire", "3-5mm") stay on one line. */
@media (min-width: 961px) {
  .stoneDetailsTable th:nth-child(1),
  .stoneDetailsTable td:nth-child(1) { width: 26%; }
  .stoneDetailsTable th:nth-child(2),
  .stoneDetailsTable td:nth-child(2) { width: 16%; }
  .stoneDetailsTable th:nth-child(3),
  .stoneDetailsTable td:nth-child(3) { width: 10%; }
  .stoneDetailsTable th:nth-child(4),
  .stoneDetailsTable td:nth-child(4) { width: 11%; }
  .stoneDetailsTable th:nth-child(5),
  .stoneDetailsTable td:nth-child(5) { width: 11%; }
  .stoneDetailsTable th:nth-child(6),
  .stoneDetailsTable td:nth-child(6) { width: 12%; }
  .stoneDetailsTable th:nth-child(7),
  .stoneDetailsTable td:nth-child(7) { width: 14%; }

  /* Size and Cut are always short ("3-5mm", "Round") so they're kept to one
     line. Type is NOT forced to nowrap — real catalog values vary a lot in
     length (e.g. live product DIM-7699 GSP has "Natural Diamond & Sapphire-
     Gemstone"), and a long value with nowrap would overflow its cell and
     visually overlap the Count column instead of safely wrapping. Since
    table-layout is fixed and word-wrap/overflow-wrap:normal (never mid-word) are set
     table-wide, an unusually long Type value just wraps onto a second line
     within its own cell — still fully contained inside the border. */
  .stoneDetailsTable td[data-label="Size"],
  .stoneDetailsTable td[data-label="Cut"] {
    white-space: nowrap;
  }
  /* Center every column heading and value on desktop (2026-09-03); mobile keeps its own left-aligned card layout below, unaffected by this override. */
.stoneDetailsTable th,
.stoneDetailsTable td {
text-align: center;
}
}

/* ---------------- Mobile: each stone as its own clearly bordered card ---------------- */
@media (max-width: 960px) {
  .stoneDetailsTable,
  .stoneDetailsTable thead,
  .stoneDetailsTable tbody,
  .stoneDetailsTable th,
  .stoneDetailsTable td,
  .stoneDetailsTable tr {
    display: block;
  }

  .stoneDetailsTable thead {
    display: none;
  }

  .stoneDetailsTable tbody tr {
    border: 1px solid #c4d0da;
    border-radius: 6px;
    margin: 0 0 14px 0;
    padding: 0;
    background: #fbfdfe;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(20, 40, 60, 0.06);
  }

  .stoneDetailsTable tbody tr:last-child {
    margin-bottom: 0;
  }

  .stoneDetailsTable tbody tr:nth-child(even) {
    background: #fbfdfe;
  }

  .stoneDetailsTable td {
    border: none;
    padding: 5px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  /* Type row becomes a colored header bar that caps each card, so the two
     stones are visually unmistakable at a glance. */
  .stoneDetailsTable td[data-label="Type"] {
    display: block;
    background: #eef2f6;
    border-bottom: 1px solid #d8dee3;
    padding: 10px 12px;
    margin: 0;
  }

  .stoneDetailsTable td[data-label="Type"]::before {
    display: block;
    content: attr(data-label);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #7c8b96;
    font-weight: bold;
    margin-bottom: 2px;
  }

  .stoneDetailsTable td[data-label="Type"] {
    font-size: 15px;
    font-weight: 700;
    color: #16324a;
  }

  .stoneDetailsTable td:not([data-label="Type"]):nth-of-type(even) {
    background: #f3f7f9;
  }

  .stoneDetailsTable td::before {
    content: attr(data-label);
    font-weight: bold;
    color: #6b7a86;
    flex: 0 0 auto;
  }

  /* A field with no value for this stone (e.g. Clarity on a stone that
     doesn't have one) is dropped from the card entirely — no dash, no
     "N/A", no empty row with just a label and nothing after it. */
  .stoneDetailsTable td:empty {
    display: none;
  }
}
