/* Fonts: Caveat, Pangolin — SIL OFL 1.1 */

@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/caveat-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/caveat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/pangolin-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/pangolin-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light only;

  --paper: #ffffff;
  --ink: #23262d;
  --pencil: #353a44;
  --muted: #646a74;
  --marker: #ffe45e;
  --focus: #2f5bea;

  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --text: "Pangolin", "Segoe Print", "Comic Sans MS", cursive;

  --gutter: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --wrap: 72rem;
  --slot-w: 76%;
  --step-mark: 3.25rem;
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main { flex: 1; }

h1, h2, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }

a { color: inherit; }
a, img, svg { -webkit-user-drag: none; }

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

mark {
  color: inherit;
  background: linear-gradient(176deg, transparent 50%, var(--marker) 50%, var(--marker) 88%, transparent 88%);
  padding: 0 0.12em;
  margin: 0 -0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px 4px 10px 6px;
  font-family: var(--hand);
  font-size: 1.4rem;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

.top,
.hero,
.sheet,
.how,
.foot {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.scribble {
  display: block;
  overflow: visible;
  fill: none;
  stroke: var(--pencil);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Header */

.top {
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: 0.5rem;
}

.logo {
  display: inline-block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(1.9rem, 1.6rem + 1vw, 2.4rem);
  line-height: 1;
  text-decoration: none;
  transform: rotate(-2deg);
}
.logo__tld { color: var(--muted); font-weight: 500; }

/* Hero */

.hero {
  display: grid;
  gap: 2.5rem;
  padding-top: clamp(2rem, 6vw, 4.5rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

.hero__title {
  display: inline-block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: min(18.8vw - 0.4rem, 2rem + 8vw, 8rem);
  line-height: 0.9;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.scribble--underline {
  width: 100%;
  height: 0.22em;
  margin-top: 0.06em;
  stroke-width: 3.2;
}

.lead {
  max-width: 34ch;
  margin-top: 1.5rem;
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.55;
}

.hero__note {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  margin-top: 1.75rem;
  font-family: var(--hand);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  transform: rotate(-3deg);
  transform-origin: left center;
}

.scribble--arrow {
  width: 4.5rem;
  height: auto;
  margin-bottom: -2.25rem;
}
.scribble--arrow-side { display: none; }

/* Slots */

.slots { display: block; }

.slot {
  --r: 0deg;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.15rem;
  width: var(--slot-w);
  max-width: 100%;
  aspect-ratio: 4 / 3;
  padding: 12%;
  text-align: center;
  transform: rotate(var(--r));
  border-radius: 18px 6px 22px 8px / 8px 20px 6px 18px;
}
.slot[data-shape="circle"] { aspect-ratio: 1; border-radius: 50%; }
.slot[data-shape="blob"] { aspect-ratio: 10 / 9; border-radius: 46% 54% 42% 58% / 55% 44% 56% 45%; }
.slot[data-shape="cloud"] { border-radius: 40% 46% 38% 44% / 48% 40% 50% 42%; }

.sketch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: var(--pencil);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.slot__num {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem);
  line-height: 1;
}

.slot__state {
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--muted);
}

.slot__tag {
  position: absolute;
  top: -0.6rem;
  right: 6%;
  padding: 0 0.35em;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.2;
  background: var(--marker);
  transform: rotate(4deg);
  border-radius: 3px 8px 4px 9px;
}

.slot.is-filled { padding: 7%; }
.slot.is-filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.slot__prompt {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -2.2rem;
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.1;
  color: var(--muted);
}

.slots--hero .slot {
  --r: -3deg;
  margin-inline: auto;
}

.sheet { padding-block: clamp(1.5rem, 4vw, 3rem); }

.slots--scatter {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.slots--scatter > .slot:nth-child(6n+1) { --r: -2deg;   align-self: flex-start; }
.slots--scatter > .slot:nth-child(6n+2) { --r: 3deg;    align-self: flex-end; }
.slots--scatter > .slot:nth-child(6n+3) { --r: 1deg;    align-self: center; }
.slots--scatter > .slot:nth-child(6n+4) { --r: -1.5deg; align-self: flex-end; }
.slots--scatter > .slot:nth-child(6n+5) { --r: 1.5deg;  align-self: flex-start; }
.slots--scatter > .slot:nth-child(6n+6) { --r: -2.5deg; align-self: flex-end; }

.slots--alt > .slot:nth-child(4n+1) { --r: 2deg;    align-self: flex-end; }
.slots--alt > .slot:nth-child(4n+2) { --r: -1deg;   align-self: flex-start; }
.slots--alt > .slot:nth-child(4n+3) { --r: -2.5deg; align-self: center; }
.slots--alt > .slot:nth-child(4n+4) { --r: 1.5deg;  align-self: flex-end; }

/* How it works */

.how { padding-block: clamp(3rem, 8vw, 6rem); }

.how__title {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(2.6rem, 2rem + 3vw, 4rem);
  line-height: 1;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

.steps {
  display: grid;
  gap: 2rem;
  margin-top: 2.5rem;
}

.step {
  display: grid;
  grid-template-columns: var(--step-mark) 1fr;
  column-gap: 1rem;
  align-items: start;
  align-content: start;
  max-width: 34rem;
}

.step__num {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--step-mark);
  height: var(--step-mark);
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
}

/* Caveat digits sit right of and below the centre of their advance box. */
.step__digit { transform: translate(var(--dx, -0.11em), -0.055em); }
.step:nth-child(1) .step__digit { --dx: -0.13em; }
.step:nth-child(2) .step__digit { --dx: -0.1em; }
.step:nth-child(3) .step__digit { --dx: -0.115em; }

.step p { padding-top: calc((var(--step-mark) - 1.6em) / 2); }

/* Footer */

.foot {
  padding-top: 3rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  font-family: var(--hand);
  font-size: 1.4rem;
  color: var(--muted);
}

.foot__line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.foot__copy { margin-right: 0.25rem; }

.foot__link {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--ink);
  border-radius: 50%;
}
.foot__link > svg:not(.sketch) {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

/* Draw-on */

.is-sketched .slot .sketch path,
.is-sketched .step__num .sketch path {
  transition: stroke-dashoffset 1.1s cubic-bezier(.55, .1, .35, 1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .is-sketched .slot .sketch path,
  .is-sketched .step__num .sketch path { transition: none; }
}

@media (min-width: 40em) {
  :root { --slot-w: clamp(12rem, 27vw, 21rem); }

  .hero__note { font-size: 1.8rem; }

  .slots--scatter {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 3vw, 2.5rem);
    row-gap: clamp(2.5rem, 5vw, 4rem);
    align-items: start;
  }
  .slots--scatter > .slot { justify-self: center; align-self: start; }

  .slots--scatter > .slot:nth-child(6n+1) { grid-column: 1 / span 4; }
  .slots--scatter > .slot:nth-child(6n+2) { grid-column: 8 / span 4; margin-top: 5rem; }
  .slots--scatter > .slot:nth-child(6n+3) { grid-column: 3 / span 4; margin-top: 0.5rem; }
  .slots--scatter > .slot:nth-child(6n+4) { grid-column: 9 / span 4; margin-top: 4rem; }
  .slots--scatter > .slot:nth-child(6n+5) { grid-column: 2 / span 4; margin-top: 1rem; }
  .slots--scatter > .slot:nth-child(6n+6) { grid-column: 7 / span 4; margin-top: 3rem; }

  .slots--alt > .slot:nth-child(4n+1) { grid-column: 2 / span 4; margin-top: 0; }
  .slots--alt > .slot:nth-child(4n+2) { grid-column: 8 / span 4; margin-top: 3.5rem; }
  .slots--alt > .slot:nth-child(4n+3) { grid-column: 4 / span 4; margin-top: 1rem; }
  .slots--alt > .slot:nth-child(4n+4) { grid-column: 9 / span 4; margin-top: 5rem; }

  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.5rem, 3vw, 3rem);
  }
  .step {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 1.25rem;
    text-align: center;
  }
  .step p { padding-top: 0; }
}

@media (min-width: 60em) {
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: center;
    gap: 3rem;
  }
  .hero__title { font-size: min(7.5rem, (min(100vw, 74rem) - 5rem) * 0.105); }

  /* Arrow spans the 3rem column gap plus the space beside the centred slot. */
  .hero__note {
    justify-content: flex-end;
    align-items: center;
    margin-right: calc(-3rem - ((min(100vw, 74rem) - 5rem) * 5 / 12 - var(--slot-w)) / 2);
    transform: rotate(-2deg);
    transform-origin: right center;
  }
  .scribble--arrow { display: none; }
  .scribble--arrow-side {
    display: block;
    width: 10rem;
    height: auto;
    margin-top: -2.5rem;
  }
}

@media print {
  .skip { display: none; }
  .slot { break-inside: avoid; }
}
