/* Ateila "After dark": the product card. One definition for every product grid on the site (home rails, lists, saved,
   "Goes with", journal rails and the cards app.js draws). Loaded last on every page. Every rule is scoped html:not(#_).
   The photographs are shown as shot (no cut, no fade, no mask) on a true black tile, so the photo's own black is the tile.
   Per photo numbers ride on the tile image as custom properties, worked out by image analysis (reports/dark-2026-11-30/rethink):
   --z scale, --tx and --ty shift (share of the tile) put each piece's mirror line at 62% of the tile height, or centre the
   piece where there is no line; --bf a black point lift only where a photo's own edge would otherwise show as a box. */

/* ---- the grid: 2 columns, 3 from 760px, 4 from 1100px ---- */
html:not(#_) .grid,html:not(#_) .hd .hd-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;column-gap:12px!important;row-gap:32px!important}
@media (min-width:760px){html:not(#_) .grid,html:not(#_) .hd .hd-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;column-gap:24px!important;row-gap:48px!important}}
@media (min-width:1100px){html:not(#_) .grid,html:not(#_) .hd .hd-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}}
html:not(#_) .grid:empty{display:none!important}

/* ---- the card: photo, name, (the gift list's option line), price, metals. Fallback: a plain column ---- */
html:not(#_) .card{position:relative;display:flex!important;flex-direction:column;align-items:stretch;margin:0;padding:0!important;background:none!important;border:0!important;border-radius:0;box-shadow:none;text-align:left;overflow:visible;color:var(--paper)}
html:not(#_) .card:hover{transform:none!important}
/* subgrid: name, price and metal rows share their height across a grid row, so nothing is reserved when both names are short.
   The grid's own row gap goes to 0 and each card carries the gap as its bottom margin (the grid gives the last one back). */
@supports (grid-template-rows:subgrid){
  html:not(#_) .grid,html:not(#_) .hd .hd-grid{row-gap:0!important;margin-bottom:-32px}
  html:not(#_) .grid>.card,html:not(#_) .hd .hd-grid>.card{display:grid!important;grid-template-rows:subgrid!important;grid-template-columns:minmax(0,1fr);grid-row:span 5!important;row-gap:0!important;align-items:start;margin-bottom:32px}
  html:not(#_) .card>.ph{grid-row:1}
  html:not(#_) .card>h3{grid-row:2}
  html:not(#_) .card>.opt-line{grid-row:3}
  html:not(#_) .card>.price{grid-row:4}
  html:not(#_) .card>.metals{grid-row:5}
  @media (min-width:760px){
    html:not(#_) .grid,html:not(#_) .hd .hd-grid{margin-bottom:-48px}
    html:not(#_) .grid>.card,html:not(#_) .hd .hd-grid>.card{margin-bottom:48px}
  }
}

/* a card drawn by a script waits, out of sight, until its photo carries its numbers (app.js sets --z, or --z:1 when the
   numbers cannot load); if no script ever gets to it, it shows anyway after 2.5 seconds */
html:not(#_) .card:has(.ph img:not([style*="--z"])){visibility:hidden;animation:card-fit-wait 0s linear 2.5s forwards}
@keyframes card-fit-wait{to{visibility:visible}}

/* ---- 1. the tile: a true black square, no edge; the photograph's own black is the tile ---- */
html:not(#_) .card .ph{position:relative;z-index:2;display:block;width:100%;aspect-ratio:1/1;margin:0;padding:0;overflow:hidden;background:#000!important;border:0!important;border-radius:0;box-shadow:none;isolation:isolate;-webkit-tap-highlight-color:transparent}
html:not(#_) .card .ph img,html:not(#_) .card .ph:hover img{display:block;width:100%;height:100%;max-width:none;margin:0;padding:0!important;aspect-ratio:1/1;object-fit:contain;background:transparent;border:0;mix-blend-mode:lighten;
  transform-origin:50% 50%;transform:translate(var(--tx,0%),var(--ty,0%)) scale(var(--z,1));transition:none;filter:var(--bf,none);
  -webkit-mask-image:none;mask-image:none}
/* the swipe track (app.js): one cell per photo, each clips its own zoomed photo */
html:not(#_) .card .ph .sw-track{display:flex;width:100%;height:100%;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;background:transparent}
html:not(#_) .card .ph .sw-track::-webkit-scrollbar{display:none}
html:not(#_) .card .ph .sw-cell{position:relative;display:block;flex:0 0 100%;min-width:100%;height:100%;overflow:hidden;scroll-snap-align:start;scroll-snap-stop:always}
html:not(#_) .card .ph .sw-track>img{flex:0 0 100%;min-width:100%}
html:not(#_) .card .sw-dots{position:absolute;left:0;right:0;bottom:8px;z-index:1;display:flex;justify-content:center;gap:6px;padding:0;pointer-events:none}
html:not(#_) .card .sw-dots i{width:4px;height:4px;background:var(--paper-3)}
html:not(#_) .card .sw-dots i.on{background:var(--paper)}
/* desks: previous and next on hover or focus, as before; never on touch screens */
html:not(#_) .card .sw-arr{position:absolute;z-index:3;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:1px solid var(--rule);border-radius:0;background:rgba(18,14,12,.72);box-shadow:none;opacity:0;transition:opacity .15s;cursor:pointer}
html:not(#_) .card .sw-prev{left:6px;right:auto}
html:not(#_) .card .sw-next{right:6px;left:auto}
html:not(#_) .card .sw-arr svg{width:15px;height:15px;fill:none;stroke:var(--paper);stroke-width:1.4}
html:not(#_) .card:hover .sw-arr,html:not(#_) .card:focus-within .sw-arr{opacity:1}
@media (hover:none),(pointer:coarse){html:not(#_) .card .sw-arr{display:none}}

/* ---- 7. the save star: inside the tile, top right, 44px target, 18px star ---- */
html:not(#_) .card .heart{position:absolute;z-index:3;top:0;right:0;left:auto;bottom:auto;display:grid;place-items:center;width:44px;height:44px;margin:0;padding:0;border:0!important;border-radius:0;background:transparent!important;box-shadow:none;color:var(--paper);transform:none!important;transition:none}
html:not(#_) .card .heart svg,html:not(#_) .card .heart svg.cool-star{width:18px;height:18px;fill:none;stroke:var(--paper);stroke-width:1.3;stroke-linejoin:round;filter:none}
html:not(#_) .card .heart[aria-pressed=true] svg,html:not(#_) .card .heart[aria-pressed=true] svg.cool-star{fill:var(--paper);stroke:var(--paper)}
html:not(#_) .card .heart:focus-visible{outline:1px solid var(--paper);outline-offset:-6px}

/* ---- 4. the name: sans, three lines at most on phones, two from 760px; the name's link covers the whole card (the photo, star and dots sit above it) ---- */
html:not(#_) .card h3{margin:12px 0 0;padding:0;min-height:0;font:400 14px/1.35 var(--sans);letter-spacing:0;text-transform:none;color:var(--paper);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden}
html:not(#_) .card h3 a{position:static;display:inline;margin:0;padding:0;font:inherit;letter-spacing:inherit;color:var(--paper);text-decoration:none}
html:not(#_) .card h3 a::after{content:"";position:absolute;inset:0;z-index:1}
html:not(#_) .card h3 a:focus-visible{outline:0}
html:not(#_) .card h3 a:focus-visible::after{outline:1px solid var(--paper);outline-offset:4px}
@media (hover:hover){html:not(#_) .card h3 a:hover{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}}
html:not(#_) .card .opt-line{margin:4px 0 0;padding:0;font:400 12.5px/1.35 var(--sans);color:var(--paper-2)}

/* ---- 5. the price: "From" small and muted, the amount in the display serif (lining figures) ---- */
html:not(#_) .card .price{display:block;margin:4px 0 0;padding:0;font:400 14px/1.35 var(--sans);color:var(--paper-2)}
html:not(#_) .card .price .amt{display:inline;font:500 22px/1.1 var(--serif);letter-spacing:-.005em;color:var(--paper);font-variant-numeric:lining-nums;white-space:nowrap}
html:not(#_) .card .price .from{margin-right:1px;font:400 12.5px/1 var(--sans);letter-spacing:0;color:var(--paper-2);vertical-align:baseline}
html:not(#_) .card .price .stock{display:none!important}

/* ---- 6. metals: 12px dots in 24px targets; the first dot's edge on the name's edge; one metal shows no row ---- */
html:not(#_) .card .metals{position:relative;z-index:2;display:flex;flex-wrap:wrap;align-items:center;gap:0;margin:4px 0 0 -6px;padding:0;align-self:start;justify-self:start;font-size:12px;color:var(--paper-2)}
html:not(#_) .card .metals:not(:has(>.swatch~.swatch)){display:none}
html:not(#_) .card .metals>span:not(.swatch),html:not(#_) .card .metals>small{display:none}
html:not(#_) .card .metals .swatch{--c:#E7E6E9;position:relative;flex:none;display:block;width:24px;height:24px;margin:0;padding:0;border:0!important;outline:0;border-radius:0!important;background:none!important;box-shadow:none;transform:none!important;transition:none;cursor:pointer;-webkit-appearance:none;appearance:none;-webkit-tap-highlight-color:transparent}
html:not(#_) .card .metals .swatch.sw-yellow{--c:#D7B465}
html:not(#_) .card .metals .swatch.sw-rose{--c:#D9A08C}
html:not(#_) .card .metals .swatch::before{content:"";position:absolute;inset:6px;border-radius:50%!important;background:var(--c)}
html:not(#_) .card .metals .swatch::after{content:"";position:absolute;inset:2px;border:1px solid transparent;border-radius:50%!important;background:none}
html:not(#_) .card .metals .swatch[aria-pressed=true]::after{border-color:var(--paper)}
html:not(#_) .card .metals span.swatch{cursor:default}
html:not(#_) .card .metals .swatch,html:not(#_) .card .metals button.swatch[aria-pressed],html:not(#_) .card .metals .swatch:focus-visible{outline:0!important}
html:not(#_) .card .metals .swatch:focus-visible::after{border-color:var(--paper);inset:0}

/* the worn photo breaks between list rows keep the same rhythm as the card rows */
html:not(#_) .grid>.c-break{margin-top:0!important;margin-bottom:32px!important}
@media (min-width:760px){html:not(#_) .grid>.c-break{margin-bottom:48px!important}}

/* the matchmaker's answer cards (mm.js) use this card too; their own label stays above the photo */
html:not(#_) .mm-card .mm-tag{z-index:3}

/* ---- 9. nothing else on the tile ---- */
html:not(#_) .card .quick,html:not(#_) .card .badge,html:not(#_) .card .burst{display:none!important}

@media (min-width:760px){
  html:not(#_) .card h3{margin-top:14px;font-size:15px;-webkit-line-clamp:2;line-clamp:2}
  html:not(#_) .card .price .amt{font-size:24px}
}
