
:root{
  /* Five tiles need 5×70 + 4×12 = 398. The rail scrolls, so it also has to
     carry the scrollbar without pushing the fifth tile onto the next row —
     and since this variant sits in a framed card, the frame's own border and
     padding (2 + 40) are added on top of that. */
  --rail-w:474px;
  --pad:20px;           /* the framed card's inner margin */
  --tile-w:70px;
  --asset:50px;
  --swatch:26px;      /* colour swatches — small chips, labelled underneath */
  --gap:12px;
  --ink:#000;
  --ink-50:rgba(0,0,0,.5);
  --ink-35:rgba(0,0,0,.35);
  --line:#ededed;       /* hairlines inside the panel */
  --frame:#e0e0e0;      /* the panel's own border — a shade stronger, so the
                           card has an edge without competing with the tiles */
  --radius:14px;
  --radius-sm:4px;
  /* One white surface. The stage used to be #f2f2f2, which read as a soft card
     behind the ring on desktop — but the option thumbnails are baked renders on
     pure white, so on a phone (no frame, panel edge to edge) the page showed a
     grey ring backdrop with white squares under every band. The hairlines do
     the separating now; the whites all agree. */
  --stage:#fff;
  --page:#fff;
  /* Without this a mobile browser may darken the page on its own — and auto
     dark leaves images untouched, so every white-backed thumbnail would keep
     glowing on a greyed panel. */
  color-scheme:light;
  --display:"Red Hat Display",-apple-system,"Segoe UI",Helvetica,Arial,sans-serif;
  --ui:"Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--page);color:var(--ink);
  font-family:var(--ui);-webkit-font-smoothing:antialiased;
}
img{display:block;max-width:100%}
[hidden]{display:none!important}


/* ---------- layout ---------- */
.shell{
  display:flex;gap:0;padding:0;
  align-items:stretch;height:100vh;height:100dvh;
}
.stage{
  flex:1 1 auto;min-width:0;background:var(--stage);
  position:relative;height:100%;
}
#viewer{position:absolute;inset:0}
.stage-brand{
  position:absolute;left:2px;top:2px;z-index:4;pointer-events:auto;
  width:172px;height:auto;
}
.stage-brand:focus-visible{outline:2px solid #ad884a;outline-offset:4px;border-radius:7px}

/* Three bands: the title block and the price footer hold their place, only the
   middle scrolls. Everything is sized off the rail's own height, so no sticky
   positioning and no z-index games. */
.rail{
  width:var(--rail-w);flex:none;
  height:100%;
  display:flex;flex-direction:column;
  border:0;border-left:1px solid var(--line);border-radius:0;
  background:var(--page);padding:20px var(--pad) 16px;
}
.rail-scroll{
  flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-gutter:stable;
  /* Pulled out to the card's inner edges so the scrollbar rides the very edge
     of the frame instead of floating a padding's width inside it. The padding
     is put back on, so the tiles stay in line with the header and the price —
     only the bar moves. */
  margin:0 calc(-1 * var(--pad));padding:0 var(--pad);
}

/* ---------- rail header ----------
   Closed by the same hairline that opens the price footer, so the panel reads
   as three bands: what you are building, the choices, what it costs.

   Both hairlines are pulled out to the card's inner edges — a rule that stops
   short of the frame reads as an underline under the text, not as a division
   of the panel. The padding is put back inside so the words stay in line with
   the tiles below them. */
.product{
  flex:none;
  margin:0 calc(-1 * var(--pad));padding:0 var(--pad) 16px;
  border-bottom:1px solid var(--line);
}
.product h1{
  font-family:var(--display);font-weight:400;font-size:25px;line-height:1.2;
  margin:0;letter-spacing:-.005em;
}

/* ---------- try-on ----------
   An offer, not a command. It sits over the ring rather than in the panel,
   because that is where the thing it acts on is, and it is deliberately quiet:
   a frosted grey chip that reads as available without competing with the stone
   or with Add to Cart. The viewer's own AR control is an icon in the same
   register — that pill column on the right — which is the language this borrows.
   Top right sits it just inside the viewer's edge against the panel, opposite
   the logo, where an offer belongs: found when looked for, ignored otherwise. */
.tryon{
  position:absolute;top:18px;right:18px;z-index:3;
  display:inline-flex;align-items:center;gap:9px;
  height:36px;padding:0 17px;border-radius:999px;
  border:1px solid rgba(0,0,0,.09);
  background:rgba(255,255,255,.74);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  color:#5f5f63;cursor:pointer;
  font-family:var(--ui);font-size:13px;line-height:1;white-space:nowrap;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
  transition:background .14s ease,color .14s ease,border-color .14s ease,opacity .14s ease;
  -webkit-tap-highlight-color:transparent;
}
.tryon:hover{background:rgba(255,255,255,.92);color:var(--ink);border-color:rgba(0,0,0,.16)}
.tryon:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.tryon[disabled]{opacity:.5;cursor:default}
.tryon svg{width:15px;height:15.6px;flex:none;display:block;opacity:.8}
/* Why nothing happened, said where the button is rather than in the console. */
.tryon-note{
  position:absolute;top:62px;right:18px;z-index:3;
  margin:0;max-width:min(300px,calc(100% - 36px));text-align:right;
  font-family:var(--ui);font-size:11.5px;line-height:1.45;color:#7a7a80;
  background:rgba(255,255,255,.8);border-radius:8px;padding:6px 10px;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
}
/* Running, the chip is the way out, so it stops whispering. */
.tryon[data-running="1"]{
  background:rgba(25,23,32,.82);color:#fff;border-color:transparent;
}
.tryon[data-running="1"] svg{opacity:1}
@media (max-width:680px){
  .tryon{top:12px;right:12px;height:34px;padding:0 14px;font-size:12.5px;gap:8px}
  .tryon-note{top:54px;right:12px;font-size:11px}
}
/* Collection name. The separator is its own span, so a wrapped line never
   starts with a stray dot. */
.product .summary{
  font-family:var(--display);font-weight:300;font-size:15px;line-height:1.5;
  color:var(--ink-50);margin:6px 0 0;
}
.product .summary .sep{padding:0 7px;color:var(--ink-35)}

/* ---------- measurements footer ---------- */
.rail-foot{flex:none;border-top:1px solid var(--line);margin:0 calc(-1 * var(--pad));padding:12px var(--pad) 0;background:var(--page)}
.measurement-panel{direction:rtl;font-family:Tahoma,Arial,sans-serif}
.measurement-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.measurement-heading h2{font-size:14px;font-weight:600;line-height:1.6;margin:0}
.measurement-heading>span{font-size:10px;color:#737373}
.measurement-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px 16px;margin:0}
.measurement-grid>div{min-width:0}
.measurement-grid dt{font-size:10.5px;line-height:1.6;color:#666}
.measurement-grid dd{margin:1px 0 0;font-size:18px;line-height:1.45;font-variant-numeric:tabular-nums;white-space:nowrap}
.measurement-grid dd small{font-size:10px;font-weight:400;color:#666;white-space:nowrap;margin-inline-start:3px}
.measurement-selection{font-size:10px;line-height:1.5;color:#666;margin:8px 0 0;overflow-wrap:anywhere}
.measurement-selection:empty{display:none}
.measurement-status{margin:7px 0 0;font-size:9.5px;line-height:1.7;color:#737373}
.rail[data-loading="1"] .measurement-panel{pointer-events:auto}
@media(max-width:600px){.measurement-grid{gap:7px 12px}.measurement-grid dd{font-size:16px}.measurement-heading{margin-bottom:7px}.measurement-grid dt{font-size:10px}.measurement-grid dd small{font-size:9px}.measurement-selection{font-size:9px}.measurement-status{font-size:9px}}

/* ---------- sections ----------
   No section headings and no rules between them: the rail is one continuous
   list of option groups, each identified by its own `Key: Value` label.
   #railBody owns the rhythm so the gap between two sections matches the gap
   between two groups inside one section. */
#railBody{display:flex;flex-direction:column;gap:23px;padding:24px 0 17px}
.sec-body{display:flex;flex-direction:column;gap:23px}

.group-label{
  font-size:15px;display:flex;gap:5px;align-items:baseline;
  width:100%;margin-bottom:-2px;
}
.group-label .k{font-weight:300;color:var(--ink)}
.group-label .v{font-weight:400}

/* Fixed tracks on the desktop rail: the captions overhang their tile by 8px
   each side so two-word labels stay on one line, and the slack that
   justify-content:start leaves on the right is what absorbs that overhang.
   Stretch tracks would let the last caption escape the panel. Phones get the
   stretch treatment inside the media query below, where the gutter is the
   thing that has to go. */
.tiles{
  display:grid;grid-template-columns:repeat(auto-fill,var(--tile-w));
  gap:var(--gap);align-items:start;justify-content:start;
}
.tiles > .group-label{grid-column:1/-1}
.tile{
  width:var(--tile-w);padding:7px;border:0;background:none;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:7px;
  border-bottom:1px solid transparent;font-family:var(--ui);
  transition:border-color .12s ease,opacity .12s ease;
  /* A <button> does NOT inherit colour: it takes the UA's button text colour.
     Desktop resolves that to black, so this looked right for months — but iOS
     Safari resolves it to the system accent and turned every caption blue.
     State it, and kill the grey tap flash while we are here. */
  color:var(--ink);
  -webkit-tap-highlight-color:transparent;
}
.tile:hover{border-bottom-color:rgba(0,0,0,.25)}
.tile[aria-pressed="true"]{border-bottom-color:var(--ink)}
.tile:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.tile .art{
  width:var(--asset);height:var(--asset);flex:none;
  display:grid;place-items:center;overflow:hidden;
}
.tile .art img{width:100%;height:100%;object-fit:contain}
/* The band icons are ONE baked render, in yellow gold. The row used to show a
   gold band while the panel said White Gold. Until the platform can give us a
   render per alloy (13 bands x 7 alloys), tint the one render toward the metal
   that is actually selected. */
.tiles.tinted .art img{filter:var(--icon-tint,none)}
/* Colour swatches (gem and metal) sit at 70% of the box — smaller than the
   line-art glyphs, which use the full 50px. */
.tile .art.round img{width:70%;height:70%;border-radius:50%;object-fit:cover}
.tile .art .dot{width:48px;height:48px;border-radius:50%;background:#d8d8d8}
/* Captions run wider than the tile so two-word labels stay on one line;
   the grid gutter absorbs the overhang. */
.tile .cap{
  font-size:11px;line-height:1.389;text-align:center;font-weight:350;
  width:calc(100% + 16px);margin:0 -8px;overflow-wrap:break-word;
}
/* Text stands in where a tile has no picture — the karat row, and any option
   whose catalogue gave us neither art nor a thumbnail. */
.tile .art.text{
  border:1px solid var(--line);font-size:13px;color:var(--ink-50);
  letter-spacing:.03em;
}
.tile[aria-pressed="true"] .art.text{border-color:var(--ink);color:var(--ink)}

/* ---------- colour swatches ----------
   Small round chips with the label under them, marked by the same underline
   the picture tiles use. Metals label themselves by purity — the colour is the
   colour, "14K" is what the colour cannot say — so three 14K chips in a row
   read as three alloys of one purity, which is exactly what they are. */
.tiles.swatches{display:flex;flex-wrap:wrap;gap:9px;align-items:flex-start}
/* The swatch rows sit closer to their label than the picture tiles do, because
   a 26px chip has no whitespace of its own to separate it. Six pixels back. */
.tiles.swatches > .group-label{flex:0 0 100%;margin-bottom:6px}
/* ONE width for every swatch, not width-to-fit: chips that size themselves to
   their caption sit at uneven distances, and a row of colours has to read as a
   regular rhythm. A two-word stone name wraps to two lines inside this width
   rather than widening its chip. */
.tile.swatch{width:52px;flex:0 0 52px;padding:0 2px 5px;gap:5px}
.tile.swatch .art{
  width:var(--swatch);height:var(--swatch);border-radius:50%;
  /* Hairline, so white gold and platinum still read as objects on a white card. */
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.16);
}
.tile.swatch .art img{width:100%;height:100%;border-radius:50%;object-fit:cover}
.tile.swatch .cap{
  width:100%;margin:0;font-size:10px;line-height:1.35;
  /* Break between words, never inside one: "Sapphir/e" is worse than a second
     line, and a chip narrow enough to force that is too narrow. 52px clears the
     longest single word in the set at this size, and keeps seven on one row. */
  overflow-wrap:normal;word-break:normal;hyphens:none;
}
.tile.swatch .art.text{border-radius:50%;font-size:10px}

/* On a phone the panel is ~325-380px wide, and seven 52px chips do not fit:
   flex-wrap dropped the last one or two onto a line of their own, so the row
   read as 6+1 with an orphan hanging under the first chip. Switch to a grid
   that divides the width it actually has — the chips share the row evenly,
   the rhythm stays regular, and the axis still reads as one row. The caption
   comes down with the column so a long single word (Aquamarine, Sapphire)
   still never breaks mid-word. */
@media (max-width:680px){
  /* 60px is the smallest column the picture captions still read at, and it is
     what lets five shapes sit on one line on a 375px phone. */
  /* Pin the phone layout to five columns whatever the screen: a fixed track
     width flips to six somewhere around 430px and orphans the last setting
     and the last band on a line of their own. 19% caps the count at five, and
     the 52px floor keeps the smallest phones from going narrower still. */
  .tiles{
    --tile-w:52px;--gap:6px;
    grid-template-columns:repeat(auto-fill,minmax(max(52px,17%),1fr));
  }
  .tiles > .tile{width:100%}
  /* Stretch tracks fill the rail exactly, so the caption overhang has no slack
     to spill into. Trim it here — a 52px column plus the gutter already holds
     the labels this panel uses. */
  .tiles > .tile > .cap{width:calc(100% + 6px);margin:0 -3px}
  .tiles.swatches{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(38px,1fr));
    gap:9px 3px;align-items:start;
  }
  .tiles.swatches > .group-label{grid-column:1/-1}
  .tile.swatch{width:auto;flex:none;padding:0 0 5px}
  /* The chip is the rhythm; the caption may lean a little into the gutter, the
     way the picture captions already do, so a long name has somewhere to go
     before the fitter has to shrink it. */
  .tile.swatch .cap{
    font-size:8.5px;line-height:1.3;
    width:calc(100% + 7px);margin-inline:-3.5px;
  }
}

/* ---------- states ---------- */
.state{
  position:absolute;inset:0;display:grid;place-items:center;z-index:3;
  background:var(--stage);text-align:center;padding:24px;
}
.state p{font-size:14px;color:var(--ink-50);max-width:34ch;line-height:1.6}
.state.err p{color:#9e2a1e}
.spinner{
  width:26px;height:26px;border:2px solid rgba(0,0,0,.14);
  border-top-color:rgba(0,0,0,.55);border-radius:50%;
  animation:spin .8s linear infinite;margin:0 auto 14px;
}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}
/* Only the very first load dims the rail; after that a single tile shows the
   wait, so the panel never blanks between choices. */
.rail[data-loading="1"] .rail-scroll{opacity:.35;pointer-events:none}
.tile .art{position:relative}
.tile[data-busy="1"] .art img{opacity:.2}
.tile[data-busy="1"] .art::after{
  content:'';position:absolute;top:50%;left:50%;width:20px;height:20px;
  margin:-10px 0 0 -10px;border:2px solid rgba(0,0,0,.16);
  border-top-color:rgba(0,0,0,.6);border-radius:50%;
  animation:spin .7s linear infinite;
}
@media (prefers-reduced-motion:reduce){.tile[data-busy="1"] .art::after{animation-duration:2.4s}}

/* ---------- mobile ---------- */
@media (max-width:900px){
  /* The page itself does not scroll. Viewer, title and price footer all hold
     their place; only the middle band moves. Same three-band structure as the
     desktop rail, so nothing needs sticky positioning here either. */
  html,body{height:100%;overflow:hidden;overscroll-behavior:none}
  .shell{flex-direction:column;gap:0;padding:0;height:100vh;height:100dvh}
  .stage{
    width:100%;flex:0 0 auto;aspect-ratio:auto;
    height:34vh;height:34dvh;min-height:200px;max-height:none;
  }
  /* No frame on a phone — the panel already fills the screen, so a border and
     rounded corners would only crop it. Both hairlines still run edge to edge,
     which here means the full width of the screen. */
  .rail{
    width:100%;flex:1 1 auto;min-height:0;height:auto;
    border:0;border-radius:0;padding:0 var(--pad);
  }
  /* Off the edge, and smaller: on a phone the logo sits over the ring, so it
     has to read as a mark on the image rather than a sticker on the corner. */
  .stage-brand{left:14px;top:12px;width:88px}
  .product{padding-top:14px;padding-bottom:12px}
  .product h1{font-size:22px}
  .product .summary{font-size:13.5px;margin-top:6px}
  #railBody{padding:18px 0 13px}
  .rail-foot{
    padding:12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  }
}

/* Keep the reference proportions and controls reachable on short screens. */
@media (max-width:900px) and (max-height:680px){
  html,body{height:auto;min-height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:auto}
  .shell{height:auto;min-height:100vh;min-height:100dvh}
  .rail{flex:0 0 auto;height:auto}
  .rail-scroll{flex:none;height:clamp(210px,44vh,320px);height:clamp(210px,44dvh,320px);min-height:210px;overscroll-behavior:auto}
}

/* Thahby branding and the current-view PNG action. */
.stage-brand{left:18px;top:18px;width:auto;min-height:44px;display:flex;align-items:center;gap:8px;color:#183f35;font-family:Tahoma,Arial,sans-serif;line-height:1.1;text-decoration:none}
.stage-brand img{width:40px;height:40px;border-radius:7px;object-fit:contain;flex:none}
.stage-brand b{display:block;font-size:22px;font-weight:700}
.stage-brand small{display:block;font:7px Arial,sans-serif;letter-spacing:2px;margin-top:5px}
.product{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:14px;row-gap:8px;font-family:Tahoma,Arial,sans-serif}
.product-heading{min-width:0}
.product h1{font-family:inherit;font-size:21px;font-weight:600;line-height:1.6;color:#183f35;letter-spacing:0}
.product .summary{font-family:inherit;font-size:11px;font-weight:400;line-height:1.6;margin-top:3px}
.export-image-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid #244d40;border-radius:7px;background:#183f35;color:#fff;min-height:44px;padding:0 12px;font:11px Tahoma,Arial,sans-serif;cursor:pointer;white-space:nowrap}
.export-image-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.export-image-button:hover:enabled{background:#2a5948}
.export-image-button:disabled{background:#edf0ea;color:#7a877f;border-color:#d9dfd7;cursor:default}
.export-image-button:focus-visible,.image-download:focus-visible,.image-export-head button:focus-visible{outline:2px solid #ad884a;outline-offset:3px}
.image-export-status{grid-column:1/-1;margin:0;color:#737b73;font-size:9px;line-height:1.6;min-height:14px}
#railBody[inert]{opacity:.65;pointer-events:none}
.image-export-dialog{width:min(560px,calc(100% - 28px));max-height:calc(100dvh - 28px);padding:20px;border:1px solid #dddcd2;border-radius:14px;background:#faf9f6;color:#183f35;box-shadow:0 20px 80px #0004;font-family:Tahoma,Arial,sans-serif;overflow:auto}
.image-export-dialog::backdrop{background:#12251f88}
.image-export-head{display:flex;justify-content:space-between;align-items:flex-start;gap:15px;margin-bottom:14px}
.image-export-head h2{margin:0;font-size:18px;line-height:1.6}
.image-export-head p{margin:3px 0 0;color:#737b73;font-size:11px;line-height:1.6}
.image-export-head button{flex:none;width:34px;height:34px;padding:0;border:1px solid #dcdfd5;border-radius:50%;background:#fff;color:#183f35;cursor:pointer;font-size:25px;line-height:1}
#imageExportPreview{display:block;width:100%;max-height:65dvh;object-fit:contain;background:#fff;border-radius:8px}
.image-download{display:flex;align-items:center;justify-content:center;gap:16px;min-height:46px;border-radius:7px;background:#183f35;color:#fff;text-decoration:none;margin-top:14px;font-size:13px}
@media(max-width:900px){.product{padding-top:12px;padding-bottom:10px}.stage-brand{top:12px;left:14px;gap:6px;align-items:flex-start}.stage-brand img{width:32px;height:32px;border-radius:6px}.stage-brand b{font-size:18px}.stage-brand small{font-size:6px;letter-spacing:1.5px}}
@media(max-width:600px){.product{column-gap:10px;row-gap:5px}.product h1{font-size:16px}.product .summary{font-size:9px;margin-top:2px}.export-image-button{font-size:10.5px;padding:0 9px;min-height:44px}.export-image-button svg{width:14px;height:14px}.image-export-status{font-size:8px;min-height:13px}}

/* The branded PNG is identical for saving and native file sharing. */
.image-export-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.image-export-actions>*{flex:1 1 160px}
.image-export-actions .image-download{margin-top:0}
.image-share{min-height:46px;padding:10px 14px;border:1px solid #183f35;border-radius:7px;background:transparent;color:#183f35;font:13px Tahoma,Arial,sans-serif;cursor:pointer}
.image-share:hover:enabled{background:#edf0e8}
.image-share:disabled{opacity:.5;cursor:default}
.image-share:focus-visible{outline:2px solid #ad884a;outline-offset:3px}
.image-share-status{margin:9px 0 0;color:#737b73;font-size:10px;line-height:1.7}
.image-share-status:empty{display:none}
