:root {
  --wall: #eee7dc;
  --wall-deep: #e2d8c9;
  --ink: #221c17;
  --muted: #8a7f73;
  --line: rgba(34, 28, 23, 0.1);
  --accent: #b8402a;
  --panel: rgba(255, 252, 247, 0.78);
  --oak-1: #c99a63;
  --oak-2: #a87842;
  --oak-3: #d8b384;
  --black-1: #1d1b1a;
  --black-2: #34312e;
  --matcol: #fbf8f2;
}

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

html, body {
  height: 100%;
  background: var(--wall);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.shop {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 2.2vh, 22px) clamp(12px, 3vw, 36px) clamp(12px, 2.4vh, 26px);
  gap: clamp(6px, 1.4vh, 14px);
  /* the wall: warm plaster, a light from above and a whisper of grain */
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 250, 240, 0.9), rgba(255, 250, 240, 0) 60%),
    linear-gradient(180deg, var(--wall) 0%, var(--wall-deep) 100%);
}

.shop::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .35 0 0 0 .5 0'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}

/* ---- the top bar ---- */
.top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}

.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.4; }
.brand__name { font-family: 'Fraunces Variable', serif; font-size: 17px; font-weight: 560; letter-spacing: -0.01em; }
.brand__sub { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.bag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 9px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.7);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(34, 28, 23, 0.06);
  font-size: 12.5px;
}
.bag__icon { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.bag__count {
  font-variant-numeric: lining-nums;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: #fbf6ee;
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
}

/* ---- the wall ---- */
.wall {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  z-index: 1;
}

.wall__light {
  position: absolute;
  left: 8%;
  right: 8%;
  top: -4%;
  height: 70%;
  pointer-events: none;
  background: radial-gradient(60% 60% at 50% 0%, rgba(255, 246, 228, 0.75), rgba(255, 246, 228, 0));
}

.wall__rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 3%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 28, 23, 0.14) 15%, rgba(34, 28, 23, 0.14) 85%, transparent);
}

.piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 140px;
  cursor: pointer;
  outline: none;
  perspective: 900px;
  --fw: 6px;
  --mw: 12px;
}

.piece__glow {
  position: absolute;
  left: -40%;
  right: -40%;
  top: -36%;
  height: 80%;
  pointer-events: none;
  background: radial-gradient(50% 55% at 50% 30%, rgba(255, 244, 222, 0.85), rgba(255, 244, 222, 0));
  opacity: 0.55;
}

/* the shadow is its own element, so lifting the print can make it softer and further away */
.piece__shadow {
  position: absolute;
  inset: 4% 3% -1% 3%;
  border-radius: 2px;
  background: rgba(46, 32, 20, 0.34);
  filter: blur(10px);
  transform: translate(0, 6px);
  pointer-events: none;
}

.piece__tilt {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.frame {
  position: absolute;
  inset: 0;
  padding: var(--fw);
  border-radius: 1.5px;
  background: var(--frame-bg, linear-gradient(135deg, var(--oak-3), var(--oak-1) 40%, var(--oak-2)));
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.35),
    0 0.5px 0 rgba(255, 255, 255, 0.4);
}

/* the oak has a faint grain, painted with repeating lines */
.frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: var(--grain, 0.5);
  background: repeating-linear-gradient(90deg, rgba(90, 55, 20, 0.12) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, rgba(90, 55, 20, 0.1) 0 1px, transparent 1px 5px);
  pointer-events: none;
}

.mat {
  position: relative;
  width: 100%;
  height: 100%;
  padding: var(--mw);
  background: var(--matcol);
  box-shadow: inset 0 1px 3px rgba(40, 28, 18, 0.18);
}

.art {
  display: block;
  width: 100%;
  height: 100%;
  box-shadow: 0 0 0 0.5px rgba(34, 28, 23, 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.art__type { font-family: 'Fraunces Variable', serif; font-size: 11px; font-weight: 600; letter-spacing: -0.02em; }
.art__small { font-family: 'Mona Sans Variable', sans-serif; font-size: 3.2px; letter-spacing: 0.18em; text-transform: uppercase; }

/* the glass: a slanted band of light that slides opposite to the pointer */
.glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 1.5px;
  opacity: var(--glass-o, 1);
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.34) 45%, rgba(255, 255, 255, 0.06) 52%, rgba(255, 255, 255, 0) 62%);
  background-size: 240% 100%;
  background-position: var(--gx, 70%) 0;
  mix-blend-mode: screen;
}

.piece[aria-pressed='true'] .piece__glow { opacity: 1; }

.piece:focus-visible .frame { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---- the panel ---- */
.panel {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'head head' 'choose add';
  align-items: center;
  gap: clamp(8px, 1.4vh, 14px) 14px;
  width: min(100%, 640px);
  margin: 0 auto;
  padding: clamp(10px, 1.8vh, 16px) clamp(12px, 2vw, 18px);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 0 0 1px var(--line),
    0 10px 30px -12px rgba(46, 32, 20, 0.28),
    0 2px 6px rgba(46, 32, 20, 0.06);
  overflow: hidden;
}

.panel__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
}

.panel__head {
  grid-area: head;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.panel__title { display: grid; gap: 2px; min-width: 0; }
.panel__title strong { font-family: 'Fraunces Variable', serif; font-size: clamp(16px, 2.6vh, 21px); font-weight: 560; letter-spacing: -0.01em; }
.panel__title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.price {
  font-variant-numeric: lining-nums;
  display: inline-flex;
  align-items: baseline;
  font-size: clamp(18px, 3vh, 24px);
  font-weight: 640;
  letter-spacing: -0.01em;
}
.price__cur { margin-right: 1px; font-weight: 500; color: var(--muted); }
.price__digits { display: inline-flex; height: 1.2em; overflow: hidden; line-height: 1.2; }
.digit { display: inline-block; height: 1.2em; overflow: hidden; text-align: center; }
.digit__col { display: flex; flex-direction: column; }
.digit__col span { height: 1.2em; }

.choose { grid-area: choose; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }

.seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(34, 28, 23, 0.06);
  box-shadow: inset 0 0 0 1px rgba(34, 28, 23, 0.06);
}

.seg__pill {
  position: absolute;
  left: 0;
  top: 3px;
  height: calc(100% - 6px);
  width: 40px;
  border-radius: 999px;
  background: #fffdf9;
  box-shadow: 0 1px 2px rgba(34, 28, 23, 0.14), 0 3px 8px -3px rgba(34, 28, 23, 0.2), inset 0 0 0 0.5px rgba(34, 28, 23, 0.08);
}

.seg__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: clamp(5px, 0.9vh, 7px) clamp(9px, 1.4vw, 12px);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s;
}
.seg__opt[aria-checked='true'] { color: var(--ink); }

.sw { width: 10px; height: 10px; border-radius: 2px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.sw--oak { background: linear-gradient(135deg, var(--oak-3), var(--oak-2)); }
.sw--black { background: linear-gradient(135deg, var(--black-2), var(--black-1)); }
.sw--none { background: var(--matcol); box-shadow: inset 0 0 0 1px rgba(34, 28, 23, 0.3); }

.add {
  grid-area: add;
  position: relative;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  height: clamp(36px, 5.4vh, 44px);
  padding: 0 clamp(14px, 2vw, 22px);
  border-radius: 999px;
  background: var(--ink);
  color: #fbf6ee;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(34, 28, 23, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.add__fill { position: absolute; inset: 0; background: #3c6b4a; transform: scaleX(0); transform-origin: left; }
.add__label, .add__done { grid-area: 1 / 1; position: relative; display: inline-flex; align-items: center; gap: 6px; }
.add__done { opacity: 0; }
.add__done svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .seg__opt:hover { color: var(--ink); }
}

/* the copy that flies to the bag */
.flyer {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 8px 20px -6px rgba(34, 28, 23, 0.45);
}
.flyer svg { display: block; width: 100%; height: 100%; }

.pointer {
  position: absolute;
  z-index: 10;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #1d1a17;
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

/* narrow screens: the panel stacks */
@media (max-width: 560px) {
  .panel { grid-template-columns: 1fr; grid-template-areas: 'head' 'choose' 'add'; border-radius: 16px; }
  .add { width: 100%; }
  .choose { justify-content: space-between; gap: 6px; }
  .seg__opt { font-size: 12px; padding: 5px 8px; }
  .brand__sub { display: none; }
}

@media (max-height: 460px) {
  .panel__title span { display: none; }
  .seg__opt { padding-top: 4px; padding-bottom: 4px; }
}
