/* Snaggle Studio. One stylesheet, no scripts. Colours and shapes follow the DinoDale app:
   ink outlines, hard little shadows, pills for anything you can press, 28px corners for the rest. */

@font-face {
  font-family: 'Fredoka';
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fredoka.woff2') format('woff2-variations');
}

:root {
  --ink: #2d2540;
  --page: #fffdf6;
  --text: #2d2540;
  --muted: #554c6c;
  --field: #6bb9f0;
  --field-far: #a9daf8;
  --sun: #ffd84a;
  --sun-glow: rgb(255 216 74 / 0.28);
  --grass: #6cc56a;
  --grass-far: #82d26d;
  --outline: #2d2540;
  --shadow: rgb(45 37 64 / 0.22);
  --tile-sun: #fff0c2;
  --tile-leaf: #e1f6cf;
  --tile-rose: #ffe2ec;
  --tile-plum: #ebe2ff;
  --wide: 1180px;
  --gutter: clamp(20px, 5vw, 48px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #1b1728;
    --text: #f6f1e7;
    --muted: #c5bfd8;
    --field: #2c5d8f;
    --field-far: #244a74;
    --sun: #f3ecd2;
    --sun-glow: rgb(243 236 210 / 0.16);
    --grass: #3d8f4c;
    --grass-far: #4aa35a;
    --outline: #0f0c18;
    --shadow: rgb(0 0 0 / 0.45);
    --tile-sun: #86602c;
    --tile-leaf: #2f6d58;
    --tile-rose: #8a4763;
    --tile-plum: #5b4a86;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 1.125rem/1.5 'Fredoka', ui-rounded, 'Nunito', system-ui, sans-serif;
}

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

h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 4px;
  border-radius: 8px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 2;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--page);
  font-weight: 600;
}
.skip:focus {
  top: 12px;
}

/* ---------- The sky: header and hero share one field, with a hill along the bottom ---------- */

.sky {
  position: relative;
  overflow: hidden;
  background: linear-gradient(var(--field), var(--field-far));
}
.sky::before,
.sky::after {
  content: '';
  position: absolute;
  left: 50%;
  width: max(160%, 1700px);
  border-radius: 50%;
  translate: -50% 0;
}
.sky::before {
  bottom: -430px;
  height: 560px;
  background: var(--grass-far);
}
.sky::after {
  bottom: -500px;
  height: 580px;
  background: var(--grass);
}

.top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--wide);
  height: 72px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.3rem;
  text-decoration: none;
  white-space: nowrap;
}
.mark {
  width: 44px;
  height: 44px;
  flex: none;
}
.tooth {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: rotate 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.brand:hover .tooth {
  rotate: 9deg;
}

.top nav {
  display: flex;
  gap: clamp(14px, 3vw, 32px);
  font-weight: 500;
}
.top nav a {
  text-decoration: none;
  text-underline-offset: 6px;
  white-space: nowrap;
}
.top nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(16px, 4vw, 56px);
  max-width: var(--wide);
  min-height: min(calc(100dvh - 72px), 700px);
  margin: 0 auto;
  padding: clamp(28px, 6vh, 72px) var(--gutter) 0;
}

.hero-copy {
  padding-bottom: clamp(120px, 20vh, 190px);
}
.hero h1 {
  max-width: 16ch;
  font-size: clamp(2.5rem, 5.1vw, 4.1rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero p {
  max-width: 31ch;
  margin-top: 22px;
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.4;
}

.button {
  display: inline-block;
  margin-top: 30px;
  padding: 14px 28px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #ffd84a;
  box-shadow: 0 6px 0 var(--ink);
  color: var(--ink);
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
  white-space: nowrap;
  transition:
    translate 0.15s,
    box-shadow 0.15s;
}
.button:hover {
  translate: 0 -2px;
  box-shadow: 0 8px 0 var(--ink);
}
.button:active {
  translate: 0 4px;
  box-shadow: 0 2px 0 var(--ink);
}

/* Meet DinoDale and the Google Play badge side by side, the badge as tall as the button. The badge picture
   brings its own clear space (41 px round a badge 168 px high), so it is pulled in by that much and the gap,
   more than a quarter of the badge's height as Google asks, puts the space back. On a phone they wrap. */
.hero-actions {
  --badge: 94px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 20px;
  margin-top: 30px;
}
.hero-actions .button {
  margin-top: 0;
}
.hero-actions .play {
  margin: calc(var(--badge) * -41 / 250);
  border-radius: 12px;
}
.hero-actions .play img {
  width: auto;
  height: var(--badge);
}

/* Rex stands on the hill, with the sun (the moon, at night) behind his shoulder. */
.hero-art {
  position: relative;
  align-self: end;
}
.hero-art::before {
  content: '';
  position: absolute;
  right: 4%;
  top: -6%;
  width: clamp(90px, 13vw, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 clamp(18px, 2.6vw, 30px) var(--sun-glow);
}
.hero-art img {
  position: relative;
  width: 100%;
  margin-bottom: clamp(-6px, -0.6vw, -2px);
}

/* ---------- DinoDale ---------- */

.app,
.how,
.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.app {
  padding-top: clamp(56px, 9vw, 112px);
  scroll-margin-top: 12px;
}
.picture {
  width: 100%;
  border: 4px solid var(--outline);
  border-radius: 28px;
  box-shadow: 0 10px 0 var(--shadow);
}
.app-copy {
  max-width: 60ch;
  margin-top: clamp(28px, 4vw, 44px);
}
h2 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.app-copy p {
  margin-top: 14px;
  font-size: clamp(1.15rem, 1.7vw, 1.3rem);
  color: var(--muted);
}
/* The store badges, as the stores hand them out. Google's picture carries its own clear space (41 px round a
   badge 168 px high, the quarter of its height that Google asks for), so the row moves left by that much to
   line the badge up with the text. Apple's badge goes next to it later, and may not be bigger than Google's. */
.stores {
  --badge: 80px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  margin-left: calc(var(--badge) * -41 / 250);
}
.stores a {
  border-radius: 12px;
}
.stores img {
  width: auto;
  height: var(--badge);
}

/* ---------- How we make things: four tiles, wide and narrow in turn ---------- */

.how {
  padding-top: clamp(64px, 10vw, 128px);
  padding-bottom: clamp(56px, 8vw, 104px);
  scroll-margin-top: 12px;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
  margin-top: clamp(24px, 3.5vw, 40px);
  list-style: none;
}
.tile {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  padding: clamp(22px, 3vw, 34px);
  padding-right: clamp(22px, 24%, 240px);
  border: 3px solid var(--outline);
  border-radius: 28px;
}
.tile:nth-child(4n + 1),
.tile:nth-child(4n + 4) {
  grid-column: span 7;
}
.tile:nth-child(4n + 2),
.tile:nth-child(4n + 3) {
  grid-column: span 5;
  /* Too narrow for words beside the picture, so here the picture sits underneath. */
  padding-right: clamp(22px, 3vw, 34px);
  padding-bottom: clamp(130px, 14vw, 170px);
}
.tile-sun {
  background: var(--tile-sun);
}
.tile-leaf {
  background: var(--tile-leaf);
}
.tile-rose {
  background: var(--tile-rose);
}
.tile-plum {
  background: var(--tile-plum);
}
.tile h3 {
  max-width: 16ch;
  font-size: clamp(1.4rem, 2.3vw, 1.8rem);
  font-weight: 600;
  line-height: 1.12;
  text-wrap: balance;
}
.tile p {
  max-width: 30ch;
  margin-top: 10px;
}
.tile img {
  position: absolute;
  right: 8px;
  bottom: -16px;
  width: clamp(170px, 20vw, 240px);
  transition: translate 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.tile:hover img {
  translate: -8px -8px;
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  flex-wrap: wrap;
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 3px solid var(--outline);
  color: var(--muted);
  font-size: 1rem;
}
.foot .brand {
  color: var(--text);
}

/* ---------- Small screens: one column ---------- */

@media (max-width: 767px) {
  .top nav a:last-child {
    display: none;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-top: 36px;
  }
  .hero-copy {
    padding-bottom: 0;
  }
  .hero h1 {
    max-width: none;
  }
  .hero-art {
    width: min(100%, 420px);
    margin: 8px auto 0;
  }
  .tile:nth-child(n) {
    grid-column: 1 / -1;
    min-height: 0;
    padding-right: clamp(22px, 3vw, 34px);
    padding-bottom: 112px;
  }
  .tile img {
    width: 160px;
  }
}

/* ---------- Movement, only for people who have not asked for less of it ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * {
    animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .hero-copy > :nth-child(2) {
    animation-delay: 0.08s;
  }
  .hero-copy > :nth-child(3) {
    animation-delay: 0.16s;
  }
  .hero-art img {
    animation: bob 3.4s ease-in-out infinite;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .tooth,
  .button,
  .tile img {
    transition: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 18px;
  }
}
@keyframes bob {
  50% {
    translate: 0 -7px;
  }
}
