/* Googly Rocks: a child's page on crumpled graph paper.
   Crayon drawings, a handwriting font, rocks whose eyes follow you around. */

@font-face {
  font-family: 'Kids';
  src: url('fonts/kids-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #23233a;
  --blue: #2c3ec0;
  --paper: #e7eaf1;
  --bounce: cubic-bezier(.2, 1.5, .4, 1);
  --hand: 'Kids', 'Segoe Print', 'Comic Sans MS', cursive;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  font-family: var(--hand);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.15;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .4em .8em; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- the paper: one fixed layer behind everything ---------- */
.paper {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--paper) url('img/paper.webp') center top / cover no-repeat;
}
@supports (animation-timeline: scroll()) {
  /* the paper drifts a little slower than the page, with no script at all */
  .paper { inset: -4% 0; animation: drift linear both; animation-timeline: scroll(root); }
  @keyframes drift { to { transform: translate3d(0, -3%, 0); } }
}

/* ---------- the googly eyes ---------- */
.rock { position: relative; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rock > img { width: 100%; }
.eye {
  position: absolute;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .08em rgba(20, 20, 40, .35), inset 0 -.08em .12em rgba(0, 0, 0, .12);
  animation: blink 6s infinite;
  animation-delay: var(--blink, 0s);
  pointer-events: none;
}
.eye b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  aspect-ratio: 1;
  margin: -23% 0 0 -23%;
  border-radius: 50%;
  background: #2a2a32;
  transition: transform .14s ease-out;
  will-change: transform;
}
.eye b::after { /* a little shine */
  content: '';
  position: absolute;
  left: 20%;
  top: 16%;
  width: 28%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
}
@keyframes blink {
  0%, 91%, 100% { transform: translate(-50%, -50%) scaleY(1); }
  94% { transform: translate(-50%, -50%) scaleY(.08); }
}
.rock.poked .eye { animation: none; transform: translate(-50%, -50%) scale(1.22); transition: transform .15s var(--bounce); }
.rock.poked .eye b { transform: scale(.6); }

.hop { animation: hop .7s var(--bounce); }
@keyframes hop {
  0% { transform: translateY(0) scale(1, 1); }
  18% { transform: translateY(0) scale(1.1, .86); }
  45% { transform: translateY(-.55em) scale(.92, 1.1) rotate(-4deg); }
  70% { transform: translateY(0) scale(1.08, .9) rotate(2deg); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* ---------- the top of the page ---------- */
.top {
  display: grid;
  justify-items: center;
  gap: .4rem;
  padding: 1.6rem clamp(1rem, 4vw, 3rem) 0;
  max-width: 1400px;
  margin: 0 auto;
}
.bar { justify-self: stretch; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.5rem; }
.social { margin-left: auto; display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem); }
.social a { display: block; width: clamp(2.6rem, 4.2vw, 4rem); }
.social img { width: 100%; }
.logo { width: min(80vw, 353px); animation: pop-in .9s var(--bounce) both; }
.logo img { width: 100%; }
.logo:hover img, .logo:focus-visible img { animation: jelly .6s var(--bounce); }
.menu { display: flex; gap: clamp(.8rem, 3vw, 2rem); font-size: clamp(1.4rem, 3vw, 2.6rem); }
.menu a { padding: .1em .3em; display: inline-block; }
.menu a:hover, .menu a:focus-visible { animation: wobble .5s ease-in-out; }
.pals { display: flex; gap: clamp(2.5rem, 8vw, 7rem); margin-top: .6rem; }
.pals .rock { width: clamp(96px, 14vw, 144px); }

.wobble:hover, .wobble:focus-visible { animation: wobble .5s ease-in-out; }
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg) scale(1.05); }
  75% { transform: rotate(7deg) scale(1.05); }
}
@keyframes jelly {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.12, .88); }
  55% { transform: scale(.94, 1.08); }
  80% { transform: scale(1.03, .98); }
  100% { transform: scale(1, 1); }
}
@keyframes pop-in {
  0% { opacity: 0; transform: translateY(-1rem) scale(.6) rotate(-6deg); }
  100% { opacity: 1; transform: none; }
}

/* ---------- scrolling reveal: things pop in once (only when scripts are on) ---------- */
.js [data-pop] { opacity: 0; transform: translateY(1.6rem) rotate(-1.5deg) scale(.96); }
.js [data-pop].in { opacity: 1; transform: none; transition: opacity .5s ease-out, transform .7s var(--bounce); transition-delay: var(--pop-delay, 0s); }

/* ---------- the house ---------- */
.scene { position: relative; overflow: hidden; margin-top: -2rem; }
.scene-inner {
  position: relative;
  width: 148%;
  left: -24%;
  aspect-ratio: 1500 / 903;
  container-type: inline-size;
}
.house { position: absolute; inset: 0; width: 100%; height: 100%; }
.lead {
  position: absolute;
  left: 50%;
  top: 29%;
  width: 52%;
  transform: translateX(-50%);
  text-align: center;
  font-size: clamp(1.4rem, 2.35cqw, 3.6rem);
  line-height: 1.3;
}
.mint {
  position: absolute;
  left: 49.5%;
  top: 66%;
  width: 27%;
  translate: -50% 0;
  animation: pulse 2.6s ease-in-out infinite;
}
.mint img { width: 100%; }
.mint:hover, .mint:focus-visible { animation: jelly .6s var(--bounce); }
.mint:active { scale: .94; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06) rotate(-1deg); } }
.scene .pair { position: absolute; left: 22%; bottom: 3%; width: 8%; }
.scene .notes { position: absolute; left: 21.5%; bottom: 17%; width: 8%; display: flex; gap: 8%; align-items: flex-end; pointer-events: none; }

.notes img { min-width: 0; animation: bob 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
.scene .notes img { width: 28%; }
.scene .notes img:nth-child(2) { width: 44%; }
.notes img:nth-child(2) { animation-duration: 1.3s; animation-delay: -.4s; }
.notes img:nth-child(3) { animation-duration: .95s; animation-delay: -.7s; }
@keyframes bob {
  0%, 100% { transform: translate(-.2em, -.2em) rotate(-15deg); }
  50% { transform: translate(.2em, .2em) rotate(15deg); }
}

/* ---------- text blocks ---------- */
.words {
  max-width: min(46rem, 88vw);
  margin: 0 auto;
  text-align: center;
  font-size: clamp(1.7rem, 3.4vw, 3.4rem);
  line-height: 1.35;
}
.words em { font-style: normal; color: var(--blue); }

/* ---------- the carousel of rocks ---------- */
.about { padding-top: clamp(2rem, 5vw, 4rem); }
.about .words { margin-bottom: clamp(1.2rem, 3vw, 2.4rem); }
.carousel {
  --w: clamp(150px, 25vw, 400px);
  position: relative;
  height: calc(var(--w) * 1.08);
  max-width: 1400px;
  margin: .4rem auto 0;
  pointer-events: none;
  overflow-x: clip; /* the rocks slide in from beyond the screen and must not widen the page */
}
.slide {
  position: absolute;
  left: 50%;
  top: 0;
  width: var(--w);
  margin-left: calc(var(--w) / -2);
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity;
  animation: slide 27s cubic-bezier(.37, 0, .63, 1) infinite;
  animation-delay: calc((var(--i) - 1) * 2.7s);
}
.slide img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .4rem; box-shadow: 0 .5rem 1.2rem rgba(30, 30, 50, .25); }
@keyframes slide {
  0% { visibility: hidden; opacity: 0; transform: translate3d(200%, 0, 0) scale(.7); }
  3%, 10% { visibility: visible; opacity: 1; transform: translate3d(104%, 0, 0) scale(.9); }
  13%, 20% { visibility: visible; opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  23%, 30% { visibility: visible; opacity: 1; transform: translate3d(-104%, 0, 0) scale(.9); }
  33% { visibility: visible; opacity: 0; transform: translate3d(-200%, 0, 0) scale(.9); }
  100% { visibility: hidden; opacity: 0; transform: translate3d(-200%, 0, 0) scale(.7); }
}
.carousel.paused .slide { animation-play-state: paused; }
.caption { display: flex; justify-content: center; align-items: flex-end; gap: .4rem; font-size: clamp(1rem, 1.6vw, 1.5rem); }
.caption span { padding-bottom: .2em; }
.caption img { width: clamp(54px, 7vw, 90px); margin-bottom: -1.4rem; transform: scaleY(-1) rotate(-10deg); }

/* ---------- the three little rocks on a strip of tape ---------- */
.photo { padding-top: 0; }
.trio { width: min(46%, 340px); margin: clamp(2.5rem, 6vw, 5rem) 0 0 auto; position: relative; }
/* one note above each singer, half the old size: --x/--y is where the bottom of the note sits */
.trio .notes { position: absolute; inset: 0; }
.trio .notes img { position: absolute; left: var(--x); top: var(--y); width: 8%; translate: -50% -100%; }
.trio .notes img:nth-child(2) { width: 15%; }

/* ---------- supply, price, distribution ---------- */
.tokens {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  max-width: 1200px;
  margin: clamp(3rem, 8vw, 7rem) auto 0;
  padding: 0 clamp(1rem, 4vw, 3rem);
  text-align: center;
}
.tokens h2 { font-weight: 400; font-size: clamp(2.2rem, 4.8vw, 4.4rem); line-height: 1; margin-bottom: 1rem; }
.tokens img { margin: 0 auto; width: min(100%, 360px); }

/* ---------- credits ---------- */
.credits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 4rem);
  max-width: 1200px;
  margin: clamp(3rem, 8vw, 7rem) auto 0;
  padding: 0 clamp(1rem, 4vw, 3rem);
  text-align: center;
  font-size: clamp(1.4rem, 2.8vw, 2.6rem);
  line-height: 1.3;
}
.credits-lead { grid-column: 1 / -1; }
.credit { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.credits a { display: inline-block; }
.credits img { width: clamp(120px, 18vw, 240px); aspect-ratio: 1; object-fit: cover; border-radius: .6rem; }
.credits .small { font-size: .8em; }

.back {
  display: block;
  width: fit-content;
  margin: clamp(3rem, 7vw, 6rem) auto 0;
  padding: .4em 1em;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  color: var(--blue);
}
.back-top { margin: 0; padding: .2em 0; font-size: clamp(1rem, 1.6vw, 1.4rem); }
.back:hover { animation: wobble .5s ease-in-out; }
footer { height: clamp(2rem, 6vw, 5rem); }

a:focus-visible { outline: .18em dashed var(--blue); outline-offset: .2em; border-radius: .4em; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .scene { margin-top: -1rem; }
  .scene-inner { width: 210%; left: -55%; }
  .scene .pair { left: 29%; width: 9%; }
  .scene .notes { left: 28.5%; width: 9%; }
  .lead { width: 42%; top: 28%; font-size: clamp(1rem, 2.7cqw, 1.7rem); }
  .tokens { grid-template-columns: 1fr; }
  .credits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trio { width: min(70%, 320px); }
  .carousel { --w: clamp(120px, 42vw, 260px); }
}

/* ---------- pausing what cannot be seen, and what should not move ---------- */
.off, .off * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-pop] { opacity: 1; transform: none; }
  .carousel { height: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 0 1rem; }
  .slide { position: static; margin: 0; width: auto; opacity: 1; visibility: visible; }
  .slide:nth-child(n+4) { display: none; }
}
