/* Claynots shop: the necklace, the builder, the bag. Uses the page tokens from system.css. */

/* ---------- necklace ---------- */
.neck { position: relative; width: 100%; aspect-ratio: 2 / 1; --m1: #e9e9ee; --m2: #9a9aa4; --bead: 64px; }
.neck--lg { --bead: clamp(56px, 6.4vw, 104px); }
.neck--md { --bead: clamp(46px, 5.2vw, 74px); }
.neck__chain { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.neck__line { fill: none; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.neck__links { fill: none; stroke: color-mix(in oklab, var(--m2) 70%, #000); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .55; }
.neck__c1 { stop-color: var(--m1); transition: stop-color .5s; }
.neck__c2 { stop-color: var(--m2); transition: stop-color .5s; }
.neck__charms { position: absolute; inset: 0; }
.neck__charm {
  position: absolute; width: var(--bead); margin-left: calc(var(--bead) / -2); margin-top: -4px;
  display: flex; flex-direction: column; align-items: center; transform-origin: 50% 0;
  transition: left .5s cubic-bezier(.3,1.4,.5,1), top .5s cubic-bezier(.3,1.4,.5,1), opacity .2s;
  cursor: grab;
}
.neck__ring { width: 12px; height: 14px; border: 2.5px solid var(--m2); border-radius: 50%; background: transparent; margin-bottom: -4px; transition: border-color .5s; }
.neck__bead {
  width: var(--bead); height: var(--bead); border-radius: 50%; background-color: #fff;
  border: 3px solid #fff; box-shadow: 0 6px 14px -6px rgb(60 20 20 / .45), inset 0 -4px 8px rgb(120 60 60 / .12);
}
.neck__charm.is-new { animation: bead-in .55s cubic-bezier(.3,1.6,.5,1) both; }
.neck__charm.is-swing { animation: swing 1.6s cubic-bezier(.2,.7,.3,1) both; }
.neck__charm.is-gone { animation: bead-out .38s ease-in forwards; }
@keyframes swing {
  0% { transform: rotate(0); } 15% { transform: rotate(var(--sw, 10deg)); } 35% { transform: rotate(calc(var(--sw, 10deg) * -.6)); }
  55% { transform: rotate(calc(var(--sw, 10deg) * .32)); } 75% { transform: rotate(calc(var(--sw, 10deg) * -.12)); } 100% { transform: rotate(0); }
}
@keyframes bead-in { from { transform: scale(.2) translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bead-out { to { transform: translateY(60px) rotate(25deg) scale(.6); opacity: 0; } }

/* ---------- hero stage ---------- */
.hero--film .hero__media { background: var(--p-surface); color: var(--ink); }
.neck-stage { position: absolute; inset: 0; display: grid; place-items: start center; padding: 2% 6% 0; }
.neck-stage .neck { width: min(100%, 1100px); }
@media (min-width: 1024px) { .neck-stage { padding-left: 44%; padding-right: 3%; padding-top: 6%; } .neck-stage .neck { --bead: clamp(56px, 5.6vw, 92px); } }
@media (max-width: 1023px) { .neck-stage { position: relative; inset: auto; padding: var(--s-5) var(--s-4) 0; } }

/* ---------- builder ---------- */
#builder .grid { align-items: start; }
.pager { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.pager__btn {
  min-height: 44px; padding: 0 var(--s-3); border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 var(--t-small)/1 var(--font-text); cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.pager__btn:hover { transform: translateY(-2px); }
.pager__btn:active { transform: translateY(0) scale(.97); }
.pager__btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sheet { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #fff; aspect-ratio: 1179 / 1475; max-height: 78svh; margin-inline: auto; }
.sheet img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.sheet.is-in img { animation: page-in .45s cubic-bezier(.2,.7,.3,1); }
@keyframes page-in { from { opacity: .2; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.hotspots { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(5, 1fr); }
.hot { position: relative; border: 0; background: transparent; cursor: pointer; border-radius: var(--r-md); transition: background .2s, box-shadow .2s; }
.hot:hover { background: rgb(255 220 220 / .35); }
.hot:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.hot__num { position: absolute; right: 8px; bottom: 8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  font: 600 12px/1 var(--font-text); background: var(--ink); color: var(--bg); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s cubic-bezier(.3,1.6,.5,1); }
.hot[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--ink); background: rgb(255 220 220 / .3); }
.hot[aria-pressed="true"] .hot__num { opacity: 1; transform: none; }
.hot:hover .hot__num { opacity: 1; transform: none; }

.typed { display: flex; gap: var(--s-2); align-items: end; margin-top: var(--s-4); flex-wrap: wrap; }
.typed .field { flex: 1 1 220px; margin: 0; }

.build-panel { position: sticky; top: calc(var(--nav-h, 64px) + var(--s-4)); background: var(--surface); border-radius: var(--r-lg); padding: var(--s-5); display: grid; gap: var(--s-4); }
.build-panel .neck { margin-bottom: var(--s-2); }
.build-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.build-price { font: 400 var(--t-h3, 32px)/1 var(--font-display); }
.metal { display: flex; gap: var(--s-2); border: 0; padding: 0; margin: 0; }
.metal legend { font: 500 var(--t-small)/1.4 var(--font-text); margin-bottom: var(--s-2); }
.metal label { flex: 1; position: relative; display: flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--line-strong); cursor: pointer; transition: border-color .2s, background .2s; }
.metal input { position: absolute; opacity: 0; }
.metal label:has(input:checked) { border-color: var(--ink); background: var(--bg); box-shadow: inset 0 0 0 1px var(--ink); }
.metal label:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(160deg, var(--a), var(--b)); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; margin: 0; min-height: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 500 var(--t-small)/1 var(--font-text); cursor: pointer; animation: chip-in .35s cubic-bezier(.3,1.6,.5,1); transition: transform .15s; }
.chip:hover { transform: translateY(-2px); }
.chip__bead { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; }
@keyframes chip-in { from { transform: scale(.4); opacity: 0; } }
.build-legal { font-size: var(--t-small); color: var(--muted); line-height: 1.5; }
.build-legal a { color: inherit; }
.status { min-height: 1.5em; font-size: var(--t-small); }
.status.is-on { animation: status-in .4s ease-out; }
@keyframes status-in { from { opacity: 0; transform: translateY(6px); } }
[data-add][disabled] { opacity: .45; cursor: not-allowed; }

.flyer { position: fixed; z-index: 90; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 10px 24px -8px rgb(60 20 20 / .5); pointer-events: none; }
.flyer-neck { position: fixed; z-index: 90; pointer-events: none; transform-origin: 50% 50%; }

/* ---------- bag ---------- */
.bag-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); background: transparent; border: 1px solid var(--line-strong); cursor: pointer; transition: transform .15s, background .2s; }
.bag-btn:hover { transform: translateY(-2px); background: var(--surface); }
.bag-btn:active { transform: scale(.95); }
.bag-btn__n { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 11px/20px var(--font-text); text-align: center; }
.bag-btn__n.is-bump { animation: bump .5s cubic-bezier(.3,1.8,.5,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.6); } 100% { transform: scale(1); } }

dialog.cart { width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--ink); }
dialog.cart[open] { animation: drawer-in .38s cubic-bezier(.2,.8,.2,1); }
dialog.cart::backdrop { background: rgb(26 20 20 / .35); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.cart__in { padding: var(--s-6) var(--s-5); display: grid; gap: var(--s-5); }
.cart__head { display: flex; justify-content: space-between; align-items: center; }
.cart__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.cart__item { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-3); padding: var(--s-4); background: var(--surface); border-radius: var(--r-md); }
.cart__beads { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.cart__bead { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; }
.cart__info { display: grid; gap: 2px; }
.cart__name { font-weight: 500; }
.cart__price { font-weight: 500; text-align: right; }
.cart__item .btn { grid-column: 2; justify-self: end; }
.cart__empty { color: var(--muted); }
.cart__total { display: flex; justify-content: space-between; font: 400 var(--t-h3, 28px)/1 var(--font-display); border-top: 1px solid var(--line); padding-top: var(--s-4); }
.check { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--t-small); line-height: 1.5; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--ink); }

/* ---------- index moment section, legal pages ---------- */
.develop { margin: 0; border-radius: var(--r-lg); overflow: hidden; height: min(620px, var(--ly-fit, 620px)); background: #fff; }
.develop > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
@media (max-width: 1023px) { .develop { height: auto; aspect-ratio: 4 / 5; margin-top: var(--s-7); } }
.nav__logo img { height: 22px; width: auto; display: block; }
.footer__logo { width: 160px; height: auto; filter: invert(88%) sepia(14%) saturate(600%) hue-rotate(310deg); }

@media (prefers-reduced-motion: reduce) {
  .neck__charm, .chip, .sheet.is-in img, dialog.cart[open], .status.is-on { animation: none !important; transition: none !important; }
}

.made-neck { margin-top: var(--s-6); }
.made-neck .neck { aspect-ratio: 3.2 / 1; --bead: clamp(54px, 6vw, 96px); }
@media (max-width: 767px) { .made-neck .neck { aspect-ratio: 1.6 / 1; --bead: 40px; } }
dialog.cart .form { grid-template-columns: 1fr; }
dialog.cart .form > * { grid-column: 1 / -1; }
/* the bag stays in the bar on a phone */
@media (max-width: 1023px) {
  .nav:not(.is-open) .nav__actions > .bag-btn { display: inline-grid; }
  .nav:not(.is-open) .nav__actions { gap: var(--s-2); }
}
@media (max-width: 400px) { .nav:not(.is-open) .nav__actions .btn--primary { display: none; } }
/* phone: a bar with the picked charms while the necklace preview is off screen */
.buildbar { display: none; }
@media (max-width: 1023px) {
  .buildbar { position: fixed; z-index: 40; left: var(--s-3); right: var(--s-3); bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-radius: var(--r-lg); background: var(--ink); color: var(--bg); box-shadow: 0 12px 30px -10px rgb(26 20 20 / .5);
    transform: translateY(140%); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
  .buildbar.is-on { transform: none; }
  .buildbar__beads { flex: 1; display: flex; min-width: 0; height: 40px; align-items: center; }
  .buildbar__beads span { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 2px solid var(--bg); margin-left: -10px; animation: chip-in .35s cubic-bezier(.3,1.6,.5,1); }
  .buildbar__beads span:first-child { margin-left: 0; }
  .buildbar__info { display: grid; font-size: var(--t-small); line-height: 1.2; text-align: right; }
  .buildbar .btn { background: var(--bg); color: var(--ink); }
}

/* scroll-in: things rise and fade in as they come on screen (set up by shop.js, so nothing hides without JS) */
.rv { opacity: 0; transform: translateY(28px); filter: blur(4px);
  transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1), filter .9s cubic-bezier(.16,1,.3,1);
  transition-delay: calc(var(--rv-i, 0) * 90ms); will-change: opacity, transform; }
.rv.is-in { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; filter: none; transition: none; } }

/* cut-out charms: the picture itself hangs from the ring, no frame */
.neck__charm { width: var(--bead); }
.neck__ring { position: relative; z-index: 1; }
img.neck__bead { width: var(--bead); height: calc(var(--bead) * 1.25); object-fit: contain; object-position: 50% 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; margin-top: -2px;
  filter: drop-shadow(0 6px 6px rgb(60 20 20 / .28)); user-select: none; -webkit-user-drag: none; }
.hotspots { display: block; }
.hot { position: absolute; }
img.flyer { border: 0; border-radius: 0; box-shadow: none; object-fit: contain; filter: drop-shadow(0 10px 12px rgb(60 20 20 / .35)); }
img.chip__bead, img.cart__bead { object-fit: contain; border: 0; border-radius: 0; background: none; }
.chip { padding-left: 6px; }
.buildbar__beads img { width: 36px; height: 36px; flex: none; object-fit: contain; margin-left: -6px; animation: chip-in .35s cubic-bezier(.3,1.6,.5,1); filter: drop-shadow(0 2px 3px rgb(0 0 0 / .4)); }
.buildbar__beads img:first-child { margin-left: 0; }

/* index: the cut-out sits over its own picture; picked = a black outline that follows the charm's shape */
.hot { padding: 0; border-radius: 0; background: none !important; box-shadow: none !important; outline: none; }
.hot__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
  transition: transform .35s cubic-bezier(.3,1.6,.5,1), filter .25s ease; }
.hot:hover .hot__img { transform: scale(1.04); filter: drop-shadow(0 6px 10px rgb(60 20 20 / .25)); }
.hot:active .hot__img { transform: scale(.97); }
.hot[aria-pressed="true"] .hot__img {
  filter: drop-shadow(2px 0 0 #1a1414) drop-shadow(-2px 0 0 #1a1414) drop-shadow(0 2px 0 #1a1414) drop-shadow(0 -2px 0 #1a1414)
          drop-shadow(0 8px 12px rgb(26 20 20 / .35));
  transform: scale(1.03);
}
.hot:focus-visible .hot__img { filter: drop-shadow(0 0 0 #1a1414) drop-shadow(2px 2px 0 #1a1414) drop-shadow(-2px -2px 0 #1a1414); }
.hot__num { right: auto; left: 50%; bottom: -6px; transform: translateX(-50%) scale(.6); }
.hot[aria-pressed="true"] .hot__num, .hot:hover .hot__num { transform: translateX(-50%); }
.hot--cell[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #1a1414 !important; }
.neck--md { --bead: clamp(64px, 8.5vw, 112px); }
.neck-stage .neck { --bead: clamp(72px, 7.5vw, 120px); }
.made-neck .neck { --bead: clamp(64px, 7vw, 112px); }
@media (max-width: 1023px) { .neck-stage { padding-top: var(--s-7); } }

/* ---------- builder feel ---------- */
.neck--edit .neck__charm { cursor: grab; touch-action: none; }
.neck--edit.is-dragging, .neck--edit.is-dragging .neck__charm { cursor: grabbing; }
.neck__charm.is-drag { z-index: 5; transition: none !important; animation: none !important; }
.neck__charm.is-drag img.neck__bead { filter: drop-shadow(0 18px 18px rgb(60 20 20 / .35)); }
.neck.is-dragging .neck__charm:not(.is-drag) { transition: left .35s cubic-bezier(.3,1.4,.5,1), top .35s cubic-bezier(.3,1.4,.5,1); }
.build-tools { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tool { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 500 var(--t-small)/1 var(--font-text); cursor: pointer;
  transition: transform .15s, background .2s, color .2s; }
.tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.tool[data-surprise] svg { fill: currentColor; stroke: none; }
.tool:hover { transform: translateY(-2px); background: var(--ink); color: var(--bg); }
.tool:active { transform: scale(.96); }
.build-hint { margin-top: calc(var(--s-2) * -1); }
.loupe { position: fixed; left: 0; top: 0; z-index: 80; width: 180px; padding: 14px 14px 10px; border-radius: var(--r-lg); background: var(--p-surface);
  box-shadow: 0 18px 40px -16px rgb(60 20 20 / .45); pointer-events: none; opacity: 0; scale: .85; transition: opacity .18s, scale .25s cubic-bezier(.3,1.6,.5,1); }
.loupe.is-on { opacity: 1; scale: 1; }
.loupe img { display: block; width: 100%; height: 140px; object-fit: contain; filter: drop-shadow(0 8px 10px rgb(60 20 20 / .25)); }
.loupe span { display: block; margin-top: 6px; text-align: center; font: 500 var(--t-small)/1 var(--font-text); }
.spark { position: fixed; z-index: 95; width: 9px; height: 9px; border-radius: 50%; pointer-events: none; }
@media (hover: none) { .loupe { display: none; } }
