/* Snow on the cards: the holiday edit of Ferncastle, a made-up home shop, on a night blue page. Two canvases hold the
   snow: the far flakes behind the cards, the near flakes, the settled snow and the clumps that slide off in front. */
:root {
  --page: #0d1424;          /* the page */
  --page-low: #121b30;      /* the page near the bottom, a little lighter */
  --card: #172036;          /* the body of a card */
  --card-top: #1c2741;      /* the top of a card, where the light falls */
  --edge: rgba(255, 255, 255, 0.07); /* the edge of a card at rest */
  --ink: #eef1f7;           /* the words */
  --muted: #8d97ad;         /* the small words */
  --accent: #d2405a;        /* cranberry, the only colour */
  --button: #eef1f7;        /* the Add button */
  --button-ink: #0d1424;    /* the words on it */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(120, 150, 210, 0.1), transparent 60%),
    linear-gradient(180deg, var(--page) 0%, var(--page-low) 100%);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a fine grain over the page, so the dark is not flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.05;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.snow {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.snow--back {
  z-index: 0;
}

.snow--front {
  z-index: 2;
}

.stage {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vh, 46px);
  padding: 12px clamp(10px, 3vw, 40px);
}

.head {
  text-align: center;
}

.head__brand {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: clamp(10px, min(1.4vw, 1.8vh), 13px);
  font-weight: 560;
  font-variation-settings: 'wdth' 112;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.head__mark {
  width: 1.25em;
  height: 1.25em;
  color: var(--accent);
}

.head__title {
  margin: clamp(6px, 1.6vh, 14px) 0 0;
  font-size: clamp(24px, min(6.4vw, 8.4vh), 76px);
  font-weight: 640;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #d8dfeb;
}

.head__line {
  display: inline-block;
}

.head__note {
  margin: clamp(6px, 1.4vh, 14px) 0 0;
  font-size: clamp(11px, min(1.6vw, 2.2vh), 16px);
  color: var(--muted);
}

.row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(8px, 2vw, 26px);
}

.card {
  width: min(27vw, 31vh, 232px);
}

.card__body {
  position: relative;
  border-radius: clamp(10px, 1.6vw, 18px);
  padding: clamp(7px, 1.4vw, 16px);
  background: linear-gradient(180deg, var(--card-top), var(--card) 46%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 18px 40px -18px rgba(0, 0, 0, 0.75);
  transition: box-shadow 0.4s ease;
}

.card__art {
  margin: 0;
  border-radius: clamp(6px, 1vw, 11px);
  background: radial-gradient(90% 80% at 50% 30%, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.card__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  filter: saturate(0.9) brightness(0.92);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.6s ease;
}

.card__img--scarf {
  object-position: 50% 30%;
}

/* a light veil: the photo sinks a little into the night blue at the bottom, and its edge catches the light */
.card__art::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(13, 20, 36, 0) 45%, rgba(13, 20, 36, 0.38));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.card__name {
  margin: clamp(6px, 1.2vw, 13px) 0 0;
  font-size: clamp(10px, min(1.3vw, 1.9vh), 15px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__meta {
  margin: 2px 0 0;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: clamp(9px, min(1.1vw, 1.6vh), 13px);
  color: var(--muted);
  white-space: nowrap;
}

.card__meta > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__price {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.add {
  margin-top: clamp(7px, 1.3vw, 14px);
  width: 100%;
  height: clamp(22px, min(3.2vw, 4.4vh), 36px);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* the face is the CSS part (press); the button itself is moved by GSAP */
.add__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font-size: clamp(10px, min(1.2vw, 1.8vh), 14px);
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 6px 14px -8px rgba(0, 0, 0, 0.6);
  transition: transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1), background-color 0.35s ease, color 0.35s ease, font-variation-settings 0.35s ease;
}

.add:active .add__face {
  transform: scale(0.96) translateY(1px);
  transition-duration: 0.08s;
}

.add.is-done .add__face {
  background: #f6e9ec;
}

.add__t {
  display: inline-block;
}

.add__ok {
  width: 0;
  height: 1.15em;
  color: var(--accent);
  overflow: visible;
  transition: width 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.add.is-done .add__ok {
  width: 1.15em;
}

.add__ok path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.add:focus-visible {
  outline: none;
}

.add:focus-visible .add__face {
  box-shadow: 0 0 0 2px var(--page), 0 0 0 3.5px var(--ink);
}

@media (hover: hover) {
  .card:hover .card__art img {
    transform: scale(1.035);
    filter: saturate(1) brightness(1);
  }

  .card:hover .card__body {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 0 0 1px rgba(255, 255, 255, 0.12),
      0 1px 2px rgba(0, 0, 0, 0.3),
      0 24px 48px -20px rgba(0, 0, 0, 0.85);
  }

  .add:hover .add__face {
    font-variation-settings: 'wdth' 118;
    background: #ffffff;
  }

  .add.is-done:hover .add__face {
    background: #f6e9ec;
  }
}

/* the drawn pointer of the autopilot: only for pointer moves that a person did not make */
.hand {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
