:root {
  --teal: #2f8a86;
  --deep: #1d5c5a;
  --cream: #f4ead2;
  --ginger: #e07a2a;
  --red: #d6322d;
  --leaf: #c4452a;
  --nut: #8b5a2b;
  --grey: #8f8a84;
  --ink: #1f1b18;
  --display: "Coiny", "Arial Rounded MT Bold", sans-serif;
  --body: "Atkinson Hyperlegible", Arial, sans-serif;
  --mono: "Victor Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  background: var(--teal) url("/images/tile.webp") repeat;
  background-size: 300px;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a,
button {
  color: inherit;
  cursor: pointer;
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(1140px, 100% - 32px);
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 24px;
  border: 0;
  border-radius: 24px;
  font-family: var(--display);
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.btn:hover {
  transform: rotate(-2deg) translateY(-2px);
}

.btn--red {
  color: #fff;
  background: var(--red);
}

.title {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 400;
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 4px 0 var(--deep);
}

/* header: magnets along the top edge */
.top .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
}

.magnet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  font-family: var(--display);
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 5px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.magnet:hover {
  transform: rotate(-8deg);
}

.magnet--logo {
  padding: 4px;
  background: var(--ginger);
}

.magnet--logo img {
  border-radius: 50%;
}

.magnet--day {
  font-size: 1.2rem;
  color: #fff;
  background: var(--red);
  transform: rotate(4deg);
}

.top-links {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.magnet--link {
  color: var(--ink);
  background: #f3c63c;
  transform: rotate(-3deg);
}

.magnet--x {
  color: #fff;
  background: #2d5fb8;
  transform: rotate(5deg);
}

/* hero: the fridge door */
.hero {
  padding: 26px 0 40px;
}

.fridge {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 30px;
  align-items: center;
  padding: 40px 40px 46px;
  border-radius: 40px 40px 28px 28px;
  background: linear-gradient(100deg, #fbf3df, var(--cream) 40%, #e9dcbc);
  box-shadow: inset -10px 0 0 #e2d3b0, inset 0 -6px 0 #e2d3b0, 0 22px 40px rgba(10, 40, 40, 0.45);
}

/* the handle on the left edge of the door */
.fridge::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 30%;
  width: 12px;
  height: 120px;
  border-radius: 6px;
  background: linear-gradient(90deg, #b8b2a6, #e8e4dc, #a39d91);
}

.name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 0.45em;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 7.4vw, 6rem);
  font-weight: 400;
  line-height: 1;
}

.word {
  display: flex;
  gap: 0.08em;
}

.tile {
  display: inline-grid;
  place-items: center;
  width: 1.2em;
  height: 1.15em;
  border-radius: 0.16em;
  color: #fff;
  text-shadow: 0 0.04em 0 rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 -0.07em 0 rgba(0, 0, 0, 0.2), 0 0.06em 0.1em rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease;
}

.tile:hover {
  transform: rotate(0) scale(1.06);
}

.t1 { background: var(--red); transform: rotate(-6deg); }
.t2 { background: #f3b31c; transform: rotate(4deg) translateY(0.05em); }
.t3 { background: #3a9d4a; transform: rotate(3deg); }
.t4 { background: #2d5fb8; transform: rotate(-5deg) translateY(0.06em); }
.t5 { background: var(--red); transform: rotate(7deg); }
.t6 { background: #f3b31c; transform: rotate(-4deg) translateY(0.04em); }
.t7 { background: #2d5fb8; transform: rotate(5deg); }
.t8 { background: #3a9d4a; transform: rotate(-7deg) translateY(0.05em); }

.calendar {
  position: relative;
  z-index: 1;
  padding: 20px 20px 18px;
  background: #fffaf0;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  transform: rotate(1.2deg);
}

.cal-month {
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cal-days,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-days {
  margin: 8px 0 4px;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

.day {
  position: relative;
  aspect-ratio: 1;
  min-height: 40px;
  padding: 3px 5px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  vertical-align: top;
  color: var(--ink);
  background: none;
}

button.day {
  display: block;
}

div.day {
  color: rgba(31, 27, 24, 0.6);
}

.day.is-today {
  background: #fff1c2;
  box-shadow: 0 0 0 3px var(--ginger);
}

/* the red paw print, stamped onto a day */
.day.is-stamped::after {
  content: "";
  position: absolute;
  inset: 22% 14% 6%;
  background: var(--red);
  -webkit-mask: url("/images/paw.svg") center / contain no-repeat;
  mask: url("/images/paw.svg") center / contain no-repeat;
}

.day.is-new::after {
  animation: stamp 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

@keyframes stamp {
  from {
    transform: scale(1.8) rotate(-15deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.cal-line {
  min-height: 3em;
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 700;
}

.peanut {
  position: absolute;
  right: -30px;
  bottom: -40px;
  z-index: 2;
  width: clamp(120px, 15vw, 190px);
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.3));
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

/* the window game */
.swat {
  padding: 40px 0;
}

.swat-intro {
  max-width: 38em;
  margin: -4px 0 20px;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--cream);
  background: rgba(29, 92, 90, 0.92);
}

.swat-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 26px;
  align-items: start;
}

.sill {
  padding: 16px;
  border-radius: 6px;
  background: var(--deep);
  box-shadow: inset 0 0 0 4px #164846, 0 16px 30px rgba(0, 0, 0, 0.4);
}

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}

.stage.is-shaking {
  animation: shake 0.3s linear;
}

@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.stage-view {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

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

.nut {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  padding: 0;
  border: 0;
  background: center / contain no-repeat;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.45));
  will-change: transform;
}

.nut--walnut { background-image: url("/images/walnut.webp"); }
.nut--almond { background-image: url("/images/almond.webp"); }
.nut--pistachio { background-image: url("/images/pistachio.webp"); }

.swat-panel {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 18px;
  border-radius: 6px;
  background: var(--cream);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.swat-cat {
  width: 150px;
  margin: -70px auto 0;
  transition: transform 0.12s ease;
}

.swat-cat.is-swatting {
  transform: rotate(-10deg) translateY(-6px);
}

.swat-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  width: 100%;
  font-size: 0.95rem;
}

.swat-stats p {
  white-space: nowrap;
}

.swat-stats b {
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--red);
}

.swat-line {
  font-weight: 700;
}

/* the gang, taped to the side of the fridge */
.gang {
  padding: 40px 0;
}

.mugshots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.mug {
  position: relative;
  margin: 0;
  padding: 12px 12px 16px;
  background: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

.mug::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 90px;
  height: 26px;
  margin-left: -45px;
  background: rgba(250, 240, 200, 0.85);
  transform: rotate(-3deg);
}

.mug:nth-child(1) { transform: rotate(-2deg); }
.mug:nth-child(2) { transform: rotate(1.5deg) translateY(14px); }
.mug:nth-child(3) { transform: rotate(-1deg); }

.mug p {
  margin-top: 10px;
  line-height: 1.4;
}

.mug b {
  display: block;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--leaf);
}

/* the Halloween incident, three polaroids */
.incident {
  padding: 40px 0;
}

.polaroids {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.polaroid {
  margin: 0;
  padding: 12px 12px 22px;
  background: #fffdf6;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.35);
}

.polaroid:nth-child(1) { transform: rotate(2deg); }
.polaroid:nth-child(2) { transform: rotate(-2deg) translateY(20px); }
.polaroid:nth-child(3) { transform: rotate(1deg); }

.polaroid p {
  margin-top: 12px;
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.3;
}

/* the coin: the grocery list under a magnet */
.coin {
  padding: 50px 0;
}

.list {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 34px 30px;
  background:
    repeating-linear-gradient(transparent 0 33px, rgba(45, 95, 184, 0.25) 33px 34px),
    #fffdf5;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.5deg);
}

.list-magnet {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2), 0 5px 8px rgba(0, 0, 0, 0.35);
}

.list-head {
  font-family: var(--display);
  font-size: 1.6rem;
}

.list-items {
  margin: 8px 0 14px;
  padding-left: 22px;
  font-size: 1.1rem;
  line-height: 34px;
}

.list-items s {
  text-decoration-color: var(--red);
  text-decoration-thickness: 3px;
}

.ticker {
  font-family: var(--display);
  font-size: clamp(3rem, 9vw, 4.6rem);
  line-height: 1;
  color: var(--red);
}

.ca-box {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 2px dashed var(--ink);
  border-radius: 6px;
  text-align: left;
  background: #fff;
}

.ca-text {
  display: block;
  font-family: var(--mono);
  font-size: clamp(11px, 3.2vw, 18px);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ca-status {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  color: var(--red);
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* footer */
.end {
  padding: 20px 0 40px;
}

.end-frame {
  position: relative;
  border: 12px solid var(--cream);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}

.end-frame img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

.end-title {
  position: absolute;
  right: 5%;
  top: 10%;
  padding: 8px 20px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 3rem);
  color: #fff;
  background: var(--red);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2), 0 6px 10px rgba(0, 0, 0, 0.35);
  transform: rotate(-4deg);
}

.end-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.end-note {
  max-width: 40em;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--cream);
  background: rgba(29, 92, 90, 0.92);
}

/* 404 */
.lost {
  padding: 40px 0 70px;
}

.lost-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  align-items: center;
  padding: 30px;
  border-radius: 30px;
  background: var(--cream);
}

.lost-title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 400;
  line-height: 1;
  color: var(--red);
}

.lost-card p {
  margin-bottom: 22px;
}

@media (max-width: 900px) {
  .fridge {
    grid-template-columns: 1fr;
    padding: 34px 26px 60px 40px;
  }

  .swat-grid {
    grid-template-columns: 1fr;
  }

  .swat-panel {
    grid-template-columns: 120px 1fr;
    align-items: center;
  }

  .swat-cat {
    width: 120px;
    margin: 0;
    grid-row: span 3;
  }

  .mugshots,
  .polaroids {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .lost-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .top .wrap {
    gap: 8px;
  }

  .magnet--link {
    display: none;
  }

  .fridge {
    padding: 28px 16px 70px 30px;
    border-radius: 28px 28px 20px 20px;
  }

  .fridge::before {
    left: 8px;
    width: 9px;
    height: 80px;
  }

  .name {
    font-size: clamp(2.1rem, 11vw, 3.3rem);
  }

  .calendar {
    padding: 14px 10px 12px;
  }

  .cal-grid {
    gap: 3px;
  }

  .day {
    min-height: 34px;
    padding: 2px 3px;
    font-size: 0.72rem;
  }

  .peanut {
    right: -8px;
    bottom: -30px;
    width: 104px;
  }

  .mugshots,
  .polaroids {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* a taped collage down the side of the fridge instead of one long column */
  .mug:nth-child(n),
  .polaroid:nth-child(n) {
    width: 70%;
    transform: rotate(-3deg);
  }

  .mug:nth-child(even),
  .polaroid:nth-child(even) {
    justify-self: end;
    margin-top: -36px;
    transform: rotate(3deg);
  }

  .mug:nth-child(3),
  .polaroid:nth-child(3) {
    margin-top: -36px;
  }

  /* each card's text lies on top of the next card's picture */
  .polaroid {
    position: relative;
  }

  .mug:nth-child(1),
  .polaroid:nth-child(1) {
    z-index: 3;
  }

  .mug:nth-child(2),
  .polaroid:nth-child(2) {
    z-index: 2;
  }

  .cal-line {
    padding-right: 76px;
  }

  .list {
    padding: 34px 18px 24px;
  }

  .end-frame {
    border-width: 8px;
  }

  .end-frame img {
    aspect-ratio: 4 / 3;
  }

  .end-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
