/* The cartouche: JewelLens's one visual idea (docs/BRAND.md).
   Every statement is written inside an outline whose SHAPE says how far it can
   be trusted, so the label survives greyscale, print and colour-blindness.

     .cart--observed   solid, clipped-corner rectangle, filled     (ink)    read or measured from the photos
     .cart--possible   dashed oval                                  (amber)  a hypothesis from the photos
     .cart--confirmed  double-ruled shield                          (teal)   the customer said so
     .cart--nv         hatched frame struck through                 (slate)  a photograph cannot show it

   Markup (any element; spans keep it inline):

     <span class="cart cart--observed cart--chip"><span class="cart__tag">Observed</span><span class="cart__body">925</span></span>
     <div  class="cart cart--possible"><span class="cart__tag">Possible</span><div class="cart__body">Art Deco inspired</div></div>
     <span class="cart cart--confirmed cart--chip"><span class="cart__body">Silver</span></span>   (tag optional)
     <span class="cart cart--observed cart--mark" aria-hidden="true"></span>                       (empty swatch of the shape, for legends)

   Sizes: default (a ledger entry), .cart--chip (one line), .cart--lg (headers, hero), .cart--mark (shape only).
   Modifier .cart--flag highlights an uncertain entry (stronger tint, not a different colour).
   Built on the app tokens only: --ink --bg --surface --line --brand --brand-ink --warn --nv.
   Do not restyle the shapes anywhere else; reuse this file (landing, shared page, collection). */

.cart {
  /* per-variant slots (overridden below) */
  --c-line: var(--ink);
  --c-fill: color-mix(in srgb, var(--ink) 9%, var(--surface));
  --c-tag: var(--muted);
  --rule: 1.5px;
  --cut: 9px;                       /* clipped corner of the Observed rectangle */
  --px: 14px; --py: 8px;
  --fs: .9375rem;
  position: relative;
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  box-sizing: border-box; max-width: 100%;
  padding: var(--py) var(--px);
  color: var(--ink); font-size: var(--fs); line-height: 1.35; text-align: left;
  vertical-align: middle;
}
div.cart, li.cart, p.cart, section.cart, article.cart { display: flex; }

.cart__tag {
  font-size: .6875em; font-weight: 650; letter-spacing: .11em; text-transform: uppercase;
  color: var(--c-tag); line-height: 1.2;
}
.cart__body { min-width: 0; overflow-wrap: anywhere; position: relative; z-index: 1; }
.cart__tag { position: relative; z-index: 1; }
.cart__mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .18em; text-transform: uppercase; }

/* ---- sizes -------------------------------------------------------------- */
.cart--chip { --px: 11px; --py: 4px; --cut: 6px; --fs: .8125rem; flex-direction: row; align-items: baseline; gap: 7px; white-space: nowrap; }
.cart--chip .cart__body { overflow-wrap: normal; }
.cart--lg   { --px: 22px; --py: 14px; --cut: 14px; --rule: 2px; --fs: 1.125rem; }
.cart--mark { --px: 0; --py: 0; width: 26px; height: 16px; --cut: 5px; padding: 0; vertical-align: -3px; display: inline-block; }
.cart--mark.cart--lg { width: 64px; height: 40px; --cut: 11px; }

/* ---- OBSERVED: solid rectangle with clipped corners, filled ------------- */
.cart--observed {
  --c-line: var(--ink);
  --c-fill: color-mix(in srgb, var(--ink) 7%, var(--surface));
  --c-tag: color-mix(in srgb, var(--ink) 72%, var(--surface));
  --cut2: calc(var(--cut) - var(--rule) * .414);
  background: var(--c-line);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
                     calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.cart--observed::before {
  content: ""; position: absolute; inset: var(--rule); z-index: 0; background: var(--c-fill);
  clip-path: polygon(var(--cut2) 0, calc(100% - var(--cut2)) 0, 100% var(--cut2), 100% calc(100% - var(--cut2)),
                     calc(100% - var(--cut2)) 100%, var(--cut2) 100%, 0 calc(100% - var(--cut2)), 0 var(--cut2));
}
.cart--observed.cart--flag::before { background: color-mix(in srgb, var(--ink) 18%, var(--surface)); }

/* ---- POSSIBLE: dashed oval, amber --------------------------------------- */
.cart--possible {
  --c-line: var(--warn);
  --c-fill: color-mix(in srgb, var(--warn) 8%, var(--surface));
  --c-tag: color-mix(in srgb, var(--warn) 62%, var(--ink));   /* AA on both themes */
  --px: 20px;
  background: var(--c-fill);
  border: 2px dashed var(--c-line);
  border-radius: 999px;
}
.cart--possible.cart--chip { --px: 14px; }
.cart--possible:not(.cart--chip) { border-radius: 2.2em / 50%; --py: 10px; }
.cart--possible.cart--flag { background: color-mix(in srgb, var(--warn) 17%, var(--surface)); border-width: 2px; }
.cart--possible.cart--mark { border-radius: 50%; }

/* ---- CONFIRMED: double-ruled shield, patina teal ------------------------- */
.cart--confirmed {
  --c-line: var(--brand);
  --c-fill: color-mix(in srgb, var(--brand) 8%, var(--surface));
  --c-tag: var(--brand-ink);
  --gap: 2.5px;
  background: var(--c-fill);
  border: var(--rule) solid var(--c-line);
  /* inner second rule */
  box-shadow: inset 0 0 0 var(--gap) var(--c-fill), inset 0 0 0 calc(var(--gap) + var(--rule)) var(--c-line);
  padding: calc(var(--py) + 4px) calc(var(--px) + 4px) calc(var(--py) + 10px);
  border-radius: 4px 4px 42% 42% / 4px 4px 34% 34%;
}
.cart--confirmed.cart--chip { padding: calc(var(--py) + 4px) calc(var(--px) + 3px) calc(var(--py) + 5px); border-radius: 3px 3px 14px 14px / 3px 3px 12px 12px; }
.cart--confirmed.cart--lg { --gap: 3.5px; border-radius: 6px 6px 38% 38% / 6px 6px 30% 30%; }
.cart--confirmed.cart--mark { padding: 0; border-radius: 2px 2px 10px 10px / 2px 2px 9px 9px; }
.cart--confirmed.cart--flag { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }

/* ---- NOT VERIFIABLE: hatched frame, struck through, slate ---------------- */
.cart--nv {
  --c-line: var(--nv);
  --c-tag: color-mix(in srgb, var(--nv) 70%, var(--ink));
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--nv) 24%, transparent) 0 1px, transparent 1px 6px),
    var(--surface);
  border: var(--rule) solid var(--c-line);
  border-radius: 2px;
  padding: calc(var(--py) + 1px) calc(var(--px) + 16px) calc(var(--py) + 1px) var(--px);
}
/* the strike: one diagonal rule across the frame's end, so the words stay readable */
.cart--nv::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 24px; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - .75px), var(--c-line) calc(50% - .75px) calc(50% + .75px), transparent calc(50% + .75px));
}
/* the strike must not steal the words: the text sits on a quiet plate */
.cart--nv .cart__body, .cart--nv .cart__tag { background: var(--surface); padding-inline: 4px; margin-inline: -4px; }
.cart--nv .cart__body { color: var(--ink); }
.cart--nv.cart--mark { padding: 0; }
.cart--nv.cart--mark::after { width: 100%; }
.cart--nv.cart--flag { border-style: double; border-width: 3px; }

/* ---- legend and ink helpers ---------------------------------------------- */
.cart-legend { display: grid; gap: 14px 22px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 0; padding: 0; list-style: none; }
.cart-legend li { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; font-size: .875rem; color: var(--muted); }
.cart-legend strong { display: block; color: var(--ink); font-size: .9375rem; font-weight: 650; }
.cart-ink-observed { color: var(--ink); }
.cart-ink-possible { color: color-mix(in srgb, var(--warn) 62%, var(--ink)); }
.cart-ink-confirmed { color: var(--brand-ink); }
.cart-ink-nv { color: color-mix(in srgb, var(--nv) 70%, var(--ink)); }

/* A "reveal" when a fact changes from Possible to Confirmed after a correction. */
@keyframes cart-settle { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }
.cart--settle { animation: cart-settle .42s cubic-bezier(.2, .9, .3, 1.2) both; }
@media (prefers-reduced-motion: reduce) { .cart--settle { animation: none; } }

/* Printing: shapes carry the label, so keep the outlines and drop the tints. */
@media print {
  .cart { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
