/* The pencil tin card: the product card of an art supply shop, on a white page. A lacquered teal tin of watercolour
   pencils sits on a pale table; the words are set in Bricolage Grotesque. */
:root {
  --page: #ffffff;          /* the page */
  --card: #fffdf8;          /* the card */
  --line: #ebe6dc;          /* the card's hairline */
  --table: #eceee8;         /* the table the tin sits on */
  --tin: #1f5560;           /* the tin's lacquer */
  --tin-dark: #123840;      /* the tin's side, in shadow */
  --metal: #c9d2d0;         /* the bare metal inside the tin */
  --label: #f4ecdb;         /* the paper label on the lid */
  --accent: #e2553a;        /* the vermilion of the label and the button */
  --gold: #c99a3e;          /* the foil printed on the pencils */
  --wood: #e9c995;          /* the sharpened wood */
  --ink: #1b1815;           /* the words */
  --muted: #8a847a;         /* the small print */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Bricolage Grotesque Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 14px 16px;
  perspective: 900px;
}

/* the card is never taller than the window: its width follows the height too */
.card {
  position: relative;
  width: min(300px, calc(100vw - 32px), calc((100vh - 28px) * 0.79));
  container-type: inline-size;
}

.tilt {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6cqw;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(27, 24, 21, 0.05), 0 18px 36px -22px rgba(27, 24, 21, 0.35);
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------------------------------------------------------------- the tin on its table */
.tin {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--table);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.scene {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------- the words */
.words {
  padding: 4.6cqw 5.4cqw 5.4cqw;
}

.eyebrow {
  margin: 0;
  font-size: 3.4cqw;
  font-weight: 560;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.title {
  margin: 1.2cqw 0 0;
  font-size: 6.4cqw;
  font-weight: 720;
  font-stretch: 85%;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.title__soft {
  font-weight: 420;
  color: var(--muted);
}

/* the strip of paper the pencil scribbles on */
.strip {
  position: relative;
  height: 14cqw;
  margin-top: 3cqw;
}

.strip__paper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.strip__name {
  position: absolute;
  right: 3cqw;
  bottom: 1.6cqw;
  font-size: 3.4cqw;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
}

.buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3cqw;
  margin-top: 3.6cqw;
}

.price {
  display: grid;
  margin: 0;
}

.price__num {
  font-size: 8.6cqw;
  font-weight: 760;
  font-stretch: 80%;
  line-height: 1;
}

.price__note {
  margin-top: 0.8cqw;
  font-size: 3cqw;
  color: var(--muted);
}

/* the add to cart pill: the words widen on the wdth axis and the pill swells */
.add {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  height: 13.4cqw;
  padding: 0 5cqw 0 4cqw;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--card);
  font: inherit;
  font-size: 4.3cqw;
  font-weight: 620;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.add:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.add__icon {
  position: relative;
  display: grid;
  width: 6.4cqw;
  height: 6.4cqw;
}

.add__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add__badge {
  position: absolute;
  top: -1.8cqw;
  right: -2.2cqw;
  min-width: 4.6cqw;
  height: 4.6cqw;
  padding: 0 1cqw;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 2.9cqw;
  font-weight: 700;
  line-height: 4.6cqw;
  text-align: center;
}

.add__words {
  display: inline-block;
  font-stretch: 92%;
}

.add__tick {
  position: absolute;
  right: 3.4cqw;
  width: 4.2cqw;
  height: 4.2cqw;
  fill: none;
  stroke: var(--card);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

@media (hover: hover) {
  .add:hover .add__words {
    font-stretch: 112%;
  }
}

.add__words {
  transition: font-stretch 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

@media (prefers-reduced-motion: reduce) {
  .add__words {
    transition: none;
  }
}
