/* Carat & Grace — the product card, section heads, option rows, cart lines, empty states.
   Card geometry: 314x480 desktop (photo 4:5 = 314x393), 175x291 mobile. */

/* ---------------------------------------------------------------- section head */
.cg-shead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 44px; }
.cg-shead__t { min-width: 0; }
.cg-shead__t .cg-eyebrow { margin-bottom: 26px; }
.cg-shead__h { max-width: 18ch; }
.cg-shead__a { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.cg-flip { transform: rotate(180deg); }
@media (max-width: 767px) {
  .cg-shead { flex-direction: column; align-items: flex-start; gap: 18px; margin-bottom: 28px; }
  .cg-shead__t .cg-eyebrow { margin-bottom: 14px; }
}

/* ---------------------------------------------------------------- product card */
.cg-card { position: relative; display: flex; flex-direction: column; }
.cg-card__m { display: block; position: relative; }
.cg-card__i { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s ease; }
.cg-card__i--alt { opacity: 0; }
/* The second photo on hover is a POINTER thing only: on a touch screen :hover sticks after a tap and the
   card would keep the alt photo (group-b-card-hover-and-drawer-care.md Part 2). */
@media (hover: hover) and (pointer: fine) { .cg-card:hover .cg-card__i--alt { opacity: 1; } }
.cg-card__w {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: rgba(251,248,245,.86); color: var(--cg-text);
  border-radius: 99px; transition: background .2s ease, color .2s ease;
}
.cg-card__w:hover { background: var(--cg-pearl); color: var(--cg-rose); }
.cg-card__w[aria-pressed='true'] { color: var(--cg-rose); }
.cg-card__w[aria-pressed='true'] svg { fill: currentColor; }
.cg-card__b { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
/* card-title-two-lines.md (Harsh, 2026-11-04: "name ki koi length fix kar do uske bad … kar do …
   mobile web sabhi me ek jaisa"). A card name is at most 2 lines and then "…", and a 1-line name still
   reserves 2 lines so the swatches, price and badges sit at the same height right across a row.
   min-height is in em, not 1lh, on purpose: it is this element's own line-height (1.35), so it needs no
   @supports fallback and the drawn size does not change.
   `.card__title` is the starter card (snippets/card-product.liquid). No template renders it today —
   every live surface uses .cg-card__t — but it is listed so the rule still holds if one is ever added. */
.cg-card__t,
.card__title {
  font-size: 15px; line-height: 1.35; min-height: calc(2 * 1.35em);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.cg-card__t:hover { color: var(--cg-rose); }
/* A clamped name cannot be read in full, so a pointer device gets the whole name in one dark box above it
   (group-b-card-hover-and-drawer-care.md Part 1). The box lives on <body>, never inside the card: a card
   clips its own overflow. --cg-tip-x puts the arrow under the name's left edge even when the box has been
   pushed sideways to stay on screen. A touch screen gets no box at all; the clamp comes off instead, so the
   name simply wraps in full. */
.cg-tip {
  position: absolute; left: 0; top: 0; z-index: 90;
  max-width: calc(100vw - 16px); padding: 10px 14px; border-radius: 6px;
  background: var(--cg-onyx); color: var(--cg-pearl);
  font-family: var(--cg-sans); font-size: 14px; line-height: 1.45;
  box-shadow: 0 10px 24px -12px rgba(30, 22, 32, .55);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .14s ease;
}
.cg-tip.is-on { opacity: 1; visibility: visible; }
.cg-tip::after {
  content: ''; position: absolute; top: 100%; left: var(--cg-tip-x, 18px);
  border: 6px solid transparent; border-top-color: var(--cg-onyx);
}
@media (hover: hover) and (pointer: fine) { .cg-card__t:hover { text-decoration: underline; } }
/* A touch screen used to get the clamp REMOVED here, so the full name could be read without a hover
   tooltip. That is exactly what Harsh reported on 4 Nov: at 375 and 768 every card name ran to 3 or 4
   lines, the name boxes measured 53/70/88px instead of one height, and the price rows in a single row
   were up to 41px out of line. The clamp now holds on touch too; the full name is still in the HTML and
   cng.js puts it in `title` on a touch device, so a long-press shows it. */
.cg-card__s { color: var(--cg-text-2); }
.cg-pricebox { display: flex; align-items: baseline; flex-wrap: wrap; }

/* card metal dots — a rail that never clips the selected ring (an earlier theme cut it off) */
.cg-card__mt { display: flex; gap: 8px; padding-top: 6px; flex-wrap: wrap; }
.cg-mt, .cg-sw {
  display: inline-block; border-radius: 99px; border: 1px solid rgba(30,22,32,.2);
  width: 16px; height: 16px; flex: 0 0 auto; transition: box-shadow .18s ease, border-color .18s ease;
}
.cg-mt.is-on, .cg-sw.is-on, .cg-mt[aria-current='true'], .cg-sw[aria-current='true'] {
  box-shadow: inset 0 0 0 2.5px var(--cg-pearl); border-color: var(--cg-text);
}
.cg-mt--white, .cg-sw--white { background: var(--cg-metal-white); }
.cg-mt--yellow, .cg-sw--yellow { background: var(--cg-metal-yellow); }
.cg-mt--rose, .cg-sw--rose { background: var(--cg-metal-rose); }
.cg-mt--platinum, .cg-sw--platinum { background: var(--cg-metal-platinum); }
.cg-mt--silver, .cg-sw--silver { background: var(--cg-metal-silver); }
.cg-sw { width: 40px; height: 40px; }

/* grid of cards: 4 up desktop, 3 at tablet, 2 on the phone — the prototype's own counts */
.cg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px 24px; }
@media (max-width: 1023px) { .cg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 20px; } }
@media (max-width: 767px) { .cg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 10px; } .cg-card__b { padding-top: 12px; gap: 4px; } .cg-card__t { font-size: 13px; } }
/* Harsh, 5 Nov: the journal / blog listing is 3 across on desktop, so five posts read 3 + 2
   instead of 4 + 1. Scoped to .cg-grid.cg-arts (the blog grid only) so the product card grid
   keeps its 4 columns; 768-1023 is already 3 and the phone is already 2, so only >=1024 moves. */
@media (min-width: 1024px) { .cg-grid.cg-arts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* rail of cards (home rails, related) */
.cg-cards-rail > * { width: 314px; }
@media (max-width: 767px) { .cg-cards-rail > * { width: 175px; } }

/* ---------------------------------------------------------------- option rows (PDP / builder) */
.cg-opt { display: flex; flex-direction: column; gap: 14px; }
.cg-opt__h { display: flex; align-items: baseline; gap: 8px; }
.cg-opt__h .cg-label { color: var(--cg-text-2); }
.cg-opt__v { color: var(--cg-text) !important; }
.cg-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.cg-pills { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cart lines */
.cg-lines { display: flex; flex-direction: column; }
.cg-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--cg-line); }
.cg-line__m { width: 84px; aspect-ratio: 84 / 100; }
.cg-line__b { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cg-line__t { font-size: 15px; }
.cg-line__p { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cg-line__x { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--cg-text-2); text-decoration: underline; }
.cg-line__x:hover { color: var(--cg-sale); }
.cg-qty { display: inline-flex; align-items: center; border: 1px solid var(--cg-line); width: max-content; }
.cg-qty__b { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.cg-qty__b:hover { background: var(--cg-porcelain); }
.cg-qty__n { min-width: 28px; text-align: center; font-size: 14px; }

.cg-sum { display: flex; flex-direction: column; gap: 12px; }
.cg-sum__row { display: flex; align-items: baseline; justify-content: space-between; }
.cg-sum__v { font-family: var(--cg-display); font-size: 26px; }
.cg-sum__note { color: var(--cg-text-2); }
.cg-sum__view { align-self: center; }

.cg-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 72px 24px; }
/* Harsh, 6 Nov: an empty state sat on ~168px of dead space before the footer — .cg-empty's own
   72px bottom padding PLUS its section's (96px on a collection and the builder, 64px on the cart).
   When the empty state is the last thing inside its wrapper there is nothing for that 72px to
   separate it from, so it goes and the section's own padding closes the page, exactly as it does
   on a page that has content. Measured: the visible .cg-empty is :last-child of .cg-wrap on the
   collection, cart, builder and no-results search pages, and on a populated page no .cg-empty is
   visible at all — so this rule cannot touch one. The top padding is untouched. */
.cg-wrap > .cg-empty:last-child { padding-bottom: 0; }
.cg-wlist { display: flex; flex-direction: column; }
.cg-wlist li { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--cg-line); }
.cg-wlist a { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.cg-wlist .cg-media { width: 56px; flex: 0 0 56px; }
.cg-wlist__t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* the saved rows carry product names as well (card-title-two-lines.md §1 counts the wishlist) — same
   2 lines, same "…". A drawer row is a list, not a grid row, so it needs no reserved height. */
.cg-wlist__t strong {
  font-weight: 400; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.cg-wlist__t em { font-style: normal; font-weight: 500; font-size: 13px; }

/* ---------------------------------------------------------------- floating controls */
.cg-skip { position: absolute; left: -9999px; }
.cg-skip:focus { left: 16px; top: 16px; z-index: 200; background: var(--cg-onyx); color: var(--cg-inverse); padding: 10px 16px; }
.cg-call {
  position: fixed; left: 20px; bottom: 20px; z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px;
  background: var(--cg-onyx); color: var(--cg-inverse); border-radius: 99px;
}
.cg-call:hover { background: var(--cg-rose); }
.cg-top-btn {
  /* stacked above "Call now", its left edge in line with it (user, 2026-10-20) — the chat widget owns bottom-right */
  position: fixed; left: 20px; bottom: 76px; z-index: 70;
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--cg-onyx); color: var(--cg-inverse); border-radius: 99px;
}
.cg-top-btn svg { transform: rotate(-90deg); }
.cg-top-btn:hover { background: var(--cg-rose); }
@media (max-width: 767px) { .cg-call span { display: none; } .cg-call { padding: 13px; } .cg-top-btn { bottom: 78px; } }

/* ---------------------------------------------------------------- card metal swap (Step 13)
   While the other metal's data is on its way: the photo dims and shimmers, the name and price go
   quiet, and the clicked swatch is already ringed. The new photo only ever appears once it has
   loaded, so no card shows one metal's photo under another's name. */
.cg-card.is-swapping .cg-card__i,
.cg-card.is-swapping .cg-card__i--alt { opacity: .5; }
.cg-card.is-swapping .cg-card__m { position: relative; overflow: hidden; }
.cg-card.is-swapping .cg-card__m::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.55) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: cg-shimmer 1.1s linear infinite;
}
.cg-card.is-swapping .cg-card__t,
.cg-card.is-swapping .cg-pricebox { opacity: .45; }
/* The swap's quick dim is for the TEXT only. It used to name .cg-card__i too and, coming later with the
   same weight, it quietly cut the hover crossfade to .2s — the photo swap is .35s above
   (group-b-card-hover-and-drawer-care.md Part 2 asks for ~.3-.4s). */
.cg-card__t, .cg-pricebox { transition: opacity .2s ease; }
@keyframes cg-shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
@media (prefers-reduced-motion: reduce) {
  .cg-card.is-swapping .cg-card__m::after { animation: none; }
}

/* PDP metal swatches carry the store's metal name underneath (pdp-system §4.1) */
.cg-swatches .cg-swl { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; color: var(--cg-text-2); text-decoration: none; }
.cg-swl__t { text-align: center; line-height: 1.25; }
.cg-swl.is-on, .cg-swl:hover { color: var(--cg-text); }
.cg-swl:focus-visible { outline: 2px solid var(--cg-text); outline-offset: 3px; }

/* ---------------------------------------------------------------- QA, 19 Nov 2026 */

/* CAG-011 (blog grid) — five articles in three columns read 3 + 2, leaving one empty cell at the
   end of the last row. The grid becomes a centred wrap at >=1024, so a short last row sits in the
   middle of the column block instead of against the left edge with a hole beside it. Column width
   and gaps are unchanged, so a full row of three is pixel-identical to before. */
@media (min-width: 1024px) {
  .cg-grid.cg-arts { display: flex; flex-wrap: wrap; justify-content: center; }
  .cg-grid.cg-arts > li { flex: 0 1 calc((100% - 48px) / 3); min-width: 0; }
}
