/* The fridge magnet letters: an enamel fridge door with a chrome handle, chunky glossy plastic letters a little
   worn by years of small hands, two fruit magnets and a couple of notes. */
:root {
  --door: #e9efe9;          /* the enamel of the door */
  --door-edge: #d3ddd6;     /* the enamel where it curves away at the sides */
  --chrome: #c9d0d2;        /* the handle and the badge */
  --red: #e4382e;           /* the letters come in these six plastics */
  --yellow: #f7c21b;
  --blue: #2c6fd8;
  --green: #2ea456;
  --orange: #f77c1f;
  --purple: #8b4cc6;
  --paper: #fffdf6;         /* the notes */
  --pencil: #3a4256;        /* the writing on the notes */
  --shadow: #1c2c28;        /* the shadow the magnets cast on the door */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--door);
}

.kitchen {
  position: fixed;
  inset: 0;
}

.door {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
  background:
    linear-gradient(90deg, var(--door-edge), transparent 6%, transparent 94%, var(--door-edge)),
    linear-gradient(180deg, color-mix(in srgb, var(--door) 70%, #ffffff), var(--door) 30%, color-mix(in srgb, var(--door) 92%, #000000));
  font-family: 'Fredoka Variable', 'Fredoka', ui-rounded, system-ui, sans-serif;
  font-size: var(--s, 60px);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.door:focus-visible {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--blue) 70%, transparent);
}

/* the long soft reflection of a kitchen window in the enamel */
.door__shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(104deg, transparent 18%, rgba(255, 255, 255, 0.5) 27%, rgba(255, 255, 255, 0.12) 33%, transparent 42%),
    linear-gradient(104deg, transparent 47%, rgba(255, 255, 255, 0.28) 50%, transparent 53%);
}

/* the chrome handle on the hinge-free side */
.door__handle {
  position: absolute;
  left: var(--handle-x, 18px);
  top: 14%;
  bottom: 14%;
  width: var(--handle-w, 16px);
  border-radius: 99px;
  background: linear-gradient(90deg, #8d979b, var(--chrome) 22%, #ffffff 40%, var(--chrome) 58%, #7c868b);
  box-shadow: 4px 6px 10px color-mix(in srgb, var(--shadow) 22%, transparent), 1px 2px 2px color-mix(in srgb, var(--shadow) 25%, transparent);
}

.door__grip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 99px;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 6px);
}

.door__badge {
  position: absolute;
  left: 50%;
  bottom: var(--badge-y, 22px);
  transform: translateX(-50%);
  padding: 0.3em 0.9em 0.36em;
  border-radius: 99px;
  font-size: max(11px, calc(var(--s, 60px) * 0.22));
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6c777b;
  background: linear-gradient(180deg, #ffffff, var(--chrome) 55%, #aeb7ba);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.door__magnets {
  position: absolute;
  inset: 0;
}

/* a magnet: the outer box is moved by GSAP (place, turn, how close to you), the body leans and clacks */
.mag {
  position: absolute;
  left: 0;
  top: 0;
  --lift: 0;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}

.mag.is-held { cursor: grabbing; }

.mag__body {
  position: relative;
  width: var(--w);
  height: var(--h);
  filter:
    drop-shadow(calc(0.012em + var(--lift) * 0.06em) calc(0.03em + var(--lift) * 0.16em) calc(0.02em + var(--lift) * 0.12em) color-mix(in srgb, var(--shadow) 38%, transparent));
}

/* a letter: the plastic seen from the side (stacked shadows, darker) and the glossy face clipped to the glyph */
.glyph {
  position: absolute;
  left: var(--gx);
  top: var(--gy);
  font-size: 1em;
  font-weight: 620;
  line-height: 1;
  white-space: pre;
  pointer-events: none;
}

.glyph--side {
  color: color-mix(in srgb, var(--c) 72%, #000000);
  text-shadow:
    0 0.015em 0 color-mix(in srgb, var(--c) 70%, #000000),
    0.006em 0.03em 0 color-mix(in srgb, var(--c) 64%, #000000),
    0.01em 0.045em 0 color-mix(in srgb, var(--c) 58%, #000000),
    0.014em 0.058em 0 color-mix(in srgb, var(--c) 50%, #000000);
}

.glyph--face {
  color: transparent;
  background:
    radial-gradient(circle at var(--s1x) var(--s1y), rgba(255, 255, 255, 0.55) 0 0.018em, transparent 0.03em),
    radial-gradient(circle at var(--s2x) var(--s2y), rgba(255, 255, 255, 0.4) 0 0.012em, transparent 0.024em),
    radial-gradient(circle at var(--s3x) var(--s3y), rgba(0, 0, 0, 0.18) 0 0.012em, transparent 0.022em),
    radial-gradient(ellipse 34% 22% at var(--wx) var(--wy), rgba(255, 255, 255, 0.26), transparent 70%),
    linear-gradient(var(--ka), transparent 46%, rgba(255, 255, 255, 0.4) 48%, transparent 51%) var(--kx) var(--ky) / 30% 26% no-repeat,
    radial-gradient(ellipse 60% 40% at 30% 18%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 70%),
    linear-gradient(165deg, color-mix(in srgb, var(--c) 78%, #ffffff) 0%, var(--c) 36%, var(--c) 66%, color-mix(in srgb, var(--c) 80%, #000000) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* fruit and notes are drawn in SVG and HTML inside the body */
.mag__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.note {
  position: absolute;
  inset: 0;
  padding: 1.25em 0.6em 0.4em;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.27em, rgba(70, 120, 200, 0.18) 1.27em 1.32em) 0 1.1em / 100% 100% no-repeat,
    linear-gradient(170deg, #ffffff, var(--paper) 60%, color-mix(in srgb, var(--paper) 92%, #8a6a30));
  border-radius: 0.02em;
  color: var(--pencil);
  font-size: 0.2em;
  line-height: 1.3;
  pointer-events: none;
  overflow: hidden;
}

.note__title {
  display: block;
  font-weight: 600;
  font-size: 1.12em;
  letter-spacing: 0.01em;
}

.note__line {
  display: block;
  font-weight: 430;
}

.note--coupon {
  padding: 1.15em 0.8em 0.5em;
  background: linear-gradient(170deg, #fff6d9, #ffe9b8);
  outline: 0.1em dashed rgba(180, 90, 40, 0.55);
  outline-offset: -0.45em;
  color: #8a3b1c;
  text-align: center;
}

.note--coupon .note__title { font-size: 1.05em; }
.note--coupon .note__big { display: block; font-weight: 650; font-size: 1.7em; line-height: 1.05; color: #d2462a; }

.pin {
  position: absolute;
  left: 50%;
  top: -0.06em;
  width: 0.34em;
  height: 0.34em;
  margin-left: -0.17em;
  pointer-events: none;
  overflow: visible;
}

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