/* The gift card that changes material with the amount. The card (.gc__card, moved only by GSAP) holds a skin
   (.gc__skin) with the four materials stacked one on the other; the one on top is the chosen finish, the next one is
   wiped in with clip-path behind a band of light (.gc__wipe). Grain, the pointer light (.gc__sheen), the brushed
   streak of the metals (.gc__streak) and the 1px rim sit over them; the words (.gc__face) on top take their colours
   from --ink and --ink-soft, which GSAP tweens with the material. */
:root {
  --page: #0b0b0c;              /* the page */
  --text: #f2f1ee;              /* the words off the card */
  --muted: rgba(242, 241, 238, 0.5); /* the small words off the card */
  --linen: #e9e1d1;             /* the linen paper card */
  --frost-a: #7c8cff;           /* the first colour under the frosted glass */
  --frost-b: #ff9ccf;           /* the second colour under the frosted glass */
  --brass-a: #a77c3c;           /* the darker brass */
  --brass-b: #f0d496;           /* the lighter brass */
  --onyx: #141416;              /* the black metal */
  --button: #f3f1ec;            /* the Add to bag button */
  --button-ink: #121212;        /* the words on the button */
  --success: #3f8f5f;           /* the check once added */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background:
    radial-gradient(70% 55% at 50% 30%, rgba(255, 255, 255, 0.05), transparent 70%),
    var(--page);
  color: var(--text);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a fine grain over the whole page, so the black is never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.gc {
  --w: min(84vw, 320px, 70vh);
  position: relative;
  width: var(--w);
  display: grid;
  gap: clamp(10px, 2.6vh, 16px);
}

/* the coloured light the card throws on the page */
.gc__pool {
  position: absolute;
  left: 12%;
  right: 12%;
  top: calc(var(--w) / 1.586 - 34px);
  height: 46px;
  border-radius: 50%;
  background-color: #b9a27a;
  filter: blur(26px);
  opacity: 0.38;
  pointer-events: none;
}

/* ------------------------------------------------------------------ the card */
.gc__card {
  position: relative;
  aspect-ratio: 1.586;
  border-radius: calc(var(--w) * 0.052);
  container-type: inline-size;
  --ink: #2b241a;
  --ink-soft: rgba(43, 36, 26, 0.62);
  --engrave: rgba(255, 255, 255, 0.5);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 8px 16px -6px rgba(0, 0, 0, 0.55),
    0 28px 56px -18px rgba(0, 0, 0, 0.8);
  -webkit-user-select: none;
  user-select: none;
}

.gc__skin {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  isolation: isolate;
  --sx: 30%;
  --sy: 20%;
  --sheen: 1;
}

.gc__mat {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.gc__mat.is-on {
  visibility: visible;
}

/* linen paper: a warm off white with a fine weave and a soft light from the top left */
.gc__mat--linen {
  background-color: var(--linen);
  background-image:
    radial-gradient(120% 90% at 18% 0%, rgba(255, 255, 255, 0.6), transparent 60%),
    repeating-linear-gradient(0deg, rgba(110, 90, 60, 0.07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 2.5px),
    repeating-linear-gradient(90deg, rgba(110, 90, 60, 0.05) 0 1px, transparent 1px 4px),
    linear-gradient(160deg, transparent 55%, rgba(120, 95, 60, 0.12));
}

/* frosted glass: two slow colours under a milky pane */
.gc__mat--frost {
  background: #1a1a24;
}

.gc__blob {
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(calc(var(--w) * 0.09));
}

.gc__blob--a {
  left: -14%;
  top: -30%;
  background: var(--frost-a);
}

.gc__blob--b {
  right: -18%;
  bottom: -42%;
  background: var(--frost-b);
}

.gc__frost {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 45%, rgba(255, 255, 255, 0.12));
}

/* brushed brass: a fine horizontal brushing over bands of light and dark gold */
.gc__mat--brass {
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, rgba(0, 0, 0, 0.045) 1px 2px, transparent 2px 3px),
    linear-gradient(112deg, var(--brass-a) 0%, var(--brass-b) 30%, #b88e4c 52%, var(--brass-b) 74%, #9b7034 100%);
}

/* black onyx metal: deep, brushed, with a cold sheen */
.gc__mat--onyx {
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 2px),
    linear-gradient(112deg, var(--onyx) 0%, #2b2b30 36%, #101012 58%, #26262b 82%, #0d0d0f 100%);
}

.gc__grain {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the soft light that follows the pointer */
.gc__sheen {
  position: absolute;
  inset: 0;
  mix-blend-mode: soft-light;
  opacity: var(--sheen);
  background: radial-gradient(55% 75% at var(--sx) var(--sy), rgba(255, 255, 255, 0.85), transparent 70%);
}

/* the brushed streak of the metals: a long vertical band at the pointer's x */
.gc__streak {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: calc(var(--sx) - 22%);
  width: 44%;
  opacity: 0;
  mix-blend-mode: overlay;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75) 46%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0.75) 54%, transparent);
}

/* the band of light that passes when the material changes */
.gc__wipe {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 18%;
  margin-left: -9%;
  opacity: 0;
  mix-blend-mode: screen;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5) 40%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 255, 255, 0.5) 60%, transparent);
  transform: skewX(-12deg);
}

/* the 1px edge that catches the light, brighter at the top */
.gc__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.gc__rim--cold {
  box-shadow:
    inset 0 0 0 1px rgba(170, 190, 255, 0.2),
    inset 0 1px 0 rgba(220, 230, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.gc__face {
  position: absolute;
  inset: 0;
  padding: 7.5cqw 7.5cqw 6.4cqw;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: var(--ink);
}

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

.gc__brand {
  display: inline-flex;
  align-items: center;
  gap: 2.4cqw;
  font-size: 4.6cqw;
  font-weight: 620;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 var(--engrave);
}

.gc__mark {
  width: 6.2cqw;
  height: 6.2cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gc__finish {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  font-size: 3.7cqw;
  font-weight: 560;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 1.4cqw 2.8cqw;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
}

.gc__finish-word {
  grid-area: 1 / 1;
  display: block;
  white-space: nowrap;
}

.gc__bottom {
  align-self: end;
  display: grid;
  gap: 0.6cqw;
}

.gc__label {
  font-size: 3.8cqw;
  font-weight: 500;
  color: var(--ink-soft);
}

.gc__amount {
  display: flex;
  align-items: flex-end;
  font-size: 15.5cqw;
  line-height: 1;
  font-weight: 640;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.035em;
  text-shadow: 0 1px 0 var(--engrave);
}

.gc__valid {
  margin-top: 2.4cqw;
  font-size: 3.2cqw;
  color: var(--ink-soft);
}

/* the rolling figures: one column per digit, a strip of a blank and 0 to 9 */
.roll {
  display: inline-block;
  height: 1.08em;
  overflow: hidden;
  vertical-align: bottom;
}

.roll__strip {
  display: block;
}

.roll__strip > span {
  display: flex;
  justify-content: center;
  height: 1.08em;
  line-height: 1.08em;
  text-align: center;
}

.roll__sign {
  display: inline-block;
  line-height: 1.08em;
}

/* ------------------------------------------------------------------ the picker */
.gc__pick {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.gc__thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: calc((100% - 8px) / 4);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 6px 14px -6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.gc__opt {
  position: relative;
  appearance: none;
  border: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  height: clamp(40px, 10.5vh, 50px);
  display: grid;
  place-content: center;
  gap: 1px;
  cursor: pointer;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.35s ease;
}

.gc__opt b {
  font-size: 14px;
  font-weight: 620;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gc__opt span {
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.gc__opt[aria-checked='true'] {
  color: var(--text);
}

.gc__opt[aria-checked='true'] b {
  font-variation-settings: 'wdth' 112;
}

.gc__opt:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}

@media (hover: hover) {
  .gc__opt:hover {
    color: rgba(242, 241, 238, 0.82);
  }
}

/* ------------------------------------------------------------------ the button */
.gc__add {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  height: clamp(44px, 11vh, 54px);
  -webkit-tap-highlight-color: transparent;
}

.gc__add:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 3px;
  border-radius: 999px;
}

.gc__add-face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
  padding: 0 7px 0 22px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--button);
  color: var(--button-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 10px 24px -12px rgba(0, 0, 0, 0.8);
}

.gc__add-shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.gc__add-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  transform: translateX(-120%);
}

.gc__add-words {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  font-size: 15px;
  font-weight: 620;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gc__add-word {
  grid-area: 1 / 1;
  display: block;
  white-space: nowrap;
  line-height: 1.3;
}

.gc__add-word + .gc__add-word {
  opacity: 0;
}

@media (hover: hover) {
  .gc__add:hover .gc__add-words {
    font-variation-settings: 'wdth' 112;
  }
}

.gc__add-chip {
  position: relative;
  display: grid;
  place-items: center;
  height: calc(100% - 14px);
  min-width: 64px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.07);
  box-shadow: inset 0 0 0 1px rgba(18, 18, 18, 0.06);
  font-size: 14px;
  font-weight: 600;
}

.gc__add-price {
  grid-area: 1 / 1;
  display: flex;
}

.gc__add-check {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.gc__add-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
