:root {
  --paper: #f6f3ee;
  --card: #ffffff;
  --ink: #1d1a17;
  --mute: #8a837b;
  --line: rgba(29, 26, 23, .1);
  --accent: #b4542a;
  --glass: rgba(255, 255, 255, .78);
  --w: clamp(168px, min(340px, calc((100vh - 176px) / 1.25)), 84vw);
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(10px, 2.4vh, 22px);
  padding: 12px 16px;
}

/* the shop bar */
.shop {
  width: min(92vw, calc(var(--w) + 150px));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shop__name {
  font-size: 14px;
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: -.01em;
}

.shop__name span { font-weight: 400; color: var(--mute); }

.bag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 6px 16px -10px rgba(29, 26, 23, .3);
  font-size: 13px;
  font-weight: 550;
}

.bag__icon { display: grid; place-items: center; width: 20px; height: 20px; }

.bag__count {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
  text-align: center;
  overflow: hidden;
  transform: scale(0);
  box-shadow: 0 0 0 2px var(--paper);
}

.bag__digits { display: flex; flex-direction: column; }
.bag__digits span { height: 18px; display: block; font-variant-numeric: tabular-nums; }

/* the card */
.card {
  width: var(--w);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.card__lift {
  background: var(--card);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 0 0 1px var(--line), 0 18px 34px -26px rgba(29, 26, 23, .45);
  will-change: transform;
}

.card:focus-visible .card__lift { box-shadow: 0 0 0 2px var(--ink), 0 18px 34px -26px rgba(29, 26, 23, .45); }

.card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 11px;
  overflow: hidden;
  background: #e9e3da;
  isolation: isolate;
}

.photo { position: absolute; inset: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo--a img { object-position: 70% 62%; transform: scale(1.12); transform-origin: 70% 62%; }
.photo--b { clip-path: inset(0 0 0 100%); }
.photo--b img { object-position: 72% 100%; transform: scale(1.42); transform-origin: 72% 100%; }

.tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}

/* the tray that rises on hover */
.tray {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 24px -16px rgba(29, 26, 23, .5);
  transform: translateY(calc(100% + 30px));
}

.sizes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.sizes__pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 7px;
  background: var(--ink);
  opacity: 0;
}

.size {
  position: relative;
  z-index: 1;
  height: 26px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color .25s;
}

.size[aria-checked="true"] { color: #fff; box-shadow: none; }

.add {
  position: relative;
  justify-self: center;
  width: 100%;
  height: 34px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
}

.add__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.add__face--hint, .add__face--done, .add__face--ring { opacity: 0; }
.add__face--hint { color: #f1c9b5; }
.ring { display: block; }

/* the info under the photo */
.card__info { padding: 10px 6px 6px; display: grid; gap: 3px; }

.card__row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__row--sub { align-items: center; }

.card__title {
  font-size: 14.5px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.card__price { font-size: 14px; font-weight: 560; font-variant-numeric: tabular-nums; }
.card__sub { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.swatches { display: flex; gap: 5px; flex: none; }

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.swatch--on { box-shadow: 0 0 0 1.5px var(--card), 0 0 0 2.5px var(--ink); }

/* the bag photo that flies to the cart */
.fly {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 10px 22px -10px rgba(29, 26, 23, .55), 0 0 0 2px #fff;
}

.fly img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 62%; display: block; }

@media (hover: hover) {
  .size:hover { box-shadow: inset 0 0 0 1px rgba(29, 26, 23, .35); }
  .size[aria-checked="true"]:hover { box-shadow: none; }
  .bag:hover { box-shadow: 0 0 0 1px rgba(29, 26, 23, .2), 0 8px 18px -10px rgba(29, 26, 23, .35); }
}

@media (max-width: 420px) {
  .card__title { font-size: 13.5px; }
  .card__info { padding-top: 8px; }
}
