/* SPDX-License-Identifier: GPL-3.0-only */
/* PurpleMonkey FM-1: the landing page. A picture book: cream paper, ink outlines drawn a little crooked, flat
   candy colours with a hard shadow, nothing quite straight, the four pets bobbing on a hill. The lower half (the
   grown-up's manual) is the same paper, set straight for reading. */

@font-face {
  font-family: "Inter Tight";
  src: url("InterTight.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FFF4D6;
  --ink: #2A1650;
  --purple: #8A4FFF;
  --grape: #5B2BC9;
  --pink: #FF5D73;
  --yellow: #FFC93C;
  --teal: #2EC4B6;
  --sky: #4CC9F0;
  --green: #7BD63B;
  --white: #FFFDF6;
  --night: #1B1240;
  --gutter: 18px;
  --max: 1080px;
  /* a line drawn by hand: no two corners alike */
  --wonk: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wonk2: 18px 225px 18px 255px / 255px 18px 225px 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper) radial-gradient(rgba(42, 22, 80, 0.07) 1.5px, transparent 1.6px) 0 0 / 22px 22px;
  color: var(--ink);
  font: 500 18px/1.55 "Inter Tight", ui-rounded, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
@media (min-width: 900px) { body { font-size: 20px; } :root { --gutter: 40px; } }
.wrap { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

a { color: var(--grape); font-weight: 700; text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-color: var(--yellow); }
a:hover { color: var(--pink); }
a:focus-visible { outline: 4px solid var(--grape); outline-offset: 4px; border-radius: 8px; }
b, strong { font-weight: 800; }
p { margin: 0 0 1em; max-width: 40em; }
code {
  font: 600 0.84em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--white); border: 2px solid var(--ink); border-radius: 8px; padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}
code .nw { white-space: nowrap; }
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.04em; line-height: 0.95; }
h2 { font-size: clamp(44px, 9vw, 96px); margin-bottom: 0.3em; }
h3 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.03em; margin: 1.4em 0 0.4em; }
section { padding: clamp(56px, 9vw, 110px) 0 0; }

/* a rhyme: big, and leaning */
.rhyme { text-wrap: balance; font-size: clamp(19px, 3.6vw, 40px); font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 0.6em; max-width: 18em; }
.rhyme em { font-style: normal; color: var(--pink); }
.say { font-size: clamp(18px, 2vw, 22px); max-width: 32em; }

/* ---- the cover ---- */
.cover { padding-top: clamp(28px, 5vw, 60px); text-align: center; position: relative; }
.cover h1 { font-size: clamp(64px, 17vw, 210px); line-height: 0.8; letter-spacing: -0.05em; }
.cover h1 .word { display: block; white-space: nowrap; }
.cover h1 i { display: inline-block; font-style: normal; -webkit-text-stroke: clamp(2px, 0.5vw, 6px) var(--ink); paint-order: stroke fill; text-shadow: 0.05em 0.05em 0 var(--ink); }
.cover h1 i:nth-child(6n+1) { color: var(--purple); transform: rotate(-7deg) translateY(0.02em); }
.cover h1 i:nth-child(6n+2) { color: var(--pink); transform: rotate(5deg) translateY(-0.04em); }
.cover h1 i:nth-child(6n+3) { color: var(--yellow); transform: rotate(-3deg) translateY(0.05em); }
.cover h1 i:nth-child(6n+4) { color: var(--teal); transform: rotate(6deg) translateY(-0.02em); }
.cover h1 i:nth-child(6n+5) { color: var(--sky); transform: rotate(-5deg) translateY(0.04em); }
.cover h1 i:nth-child(6n+6) { color: var(--green); transform: rotate(4deg) translateY(-0.05em); }
.cover h1 .word + .word i:nth-child(6n+1) { color: var(--pink); }
.cover h1 .word + .word i:nth-child(6n+2) { color: var(--purple); }
.cover .rhyme { margin: 0.9em auto 0.3em; }
.cover .say { margin: 0 auto; }
.cover .ver { display: inline-block; margin: 18px 0 0; padding: 4px 16px; background: var(--yellow); border: 3px solid var(--ink); border-radius: var(--wonk); font-weight: 800; font-size: 0.85em; transform: rotate(-2deg); }

/* the band on its hill */
.band { position: relative; margin-top: clamp(20px, 4vw, 40px); }
.band .pets { display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 4vw, 56px); padding: 0 12px; position: relative; z-index: 1; margin-bottom: -6%; }
.band .pets img { height: calc(var(--h) * clamp(0.8px, 0.19vw, 2px)); width: auto; image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 6px 0 rgba(42, 22, 80, 0.25)); transform-origin: 50% 100%; }
.band .pets img:nth-child(1) { transform: rotate(-5deg); }
.band .pets img:nth-child(2) { transform: rotate(3deg) translateY(-8%); }
.band .pets img:nth-child(3) { transform: rotate(-2deg) translateY(-10%); }
.band .pets img:nth-child(4) { transform: rotate(5deg); }
.band svg { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .band .pets img { animation: bob 1.15s ease-in-out infinite alternate; }
  .band .pets img:nth-child(2) { animation-delay: -0.3s; animation-name: bob2; }
  .band .pets img:nth-child(3) { animation-delay: -0.6s; animation-name: bob3; }
  .band .pets img:nth-child(4) { animation-delay: -0.9s; animation-name: bob4; }
  .cover h1 i { animation: jig 2.4s ease-in-out infinite alternate; }
  .cover h1 i:nth-child(even) { animation-delay: -1.2s; }
}
@keyframes bob { from { transform: rotate(-5deg) translateY(0); } to { transform: rotate(-1deg) translateY(-7%); } }
@keyframes bob2 { from { transform: rotate(3deg) translateY(-8%); } to { transform: rotate(-2deg) translateY(-15%); } }
@keyframes bob3 { from { transform: rotate(-2deg) translateY(-10%); } to { transform: rotate(3deg) translateY(-4%); } }
@keyframes bob4 { from { transform: rotate(5deg) translateY(0); } to { transform: rotate(1deg) translateY(-8%); } }
@keyframes jig { from { translate: 0 0; } to { translate: 0 -0.035em; } }

/* ---- the hill's own ground: purple, and what stands on it reads in cream ---- */
.hill { background: var(--purple); color: var(--white); padding: 8px 0 clamp(48px, 7vw, 90px); margin-top: -2px; }
.hill .rhyme em { color: var(--yellow); }

/* ---- the pages: a picture in a crooked frame, a rhyme, a line of plain talk ---- */
.pages { display: grid; gap: clamp(36px, 6vw, 72px); margin-top: clamp(20px, 4vw, 40px); }
.page { display: grid; gap: 22px; align-items: center; }
@media (min-width: 820px) {
  .page { grid-template-columns: minmax(0, 380px) 1fr; gap: 56px; }
  .page:nth-child(even) { grid-template-columns: 1fr minmax(0, 380px); }
  .page:nth-child(even) figure { order: 2; }
}
.page figure { margin: 0; padding: 14px; border: 5px solid var(--ink); border-radius: var(--wonk); box-shadow: 10px 10px 0 var(--ink); transform: rotate(-2.5deg); max-width: 380px; }
.page:nth-child(even) figure { transform: rotate(2deg); border-radius: var(--wonk2); }
.page figure img { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; border: 4px solid var(--ink); border-radius: 22px; background: var(--night); }
.page:nth-child(4n+1) figure { background: var(--teal); }
.page:nth-child(4n+2) figure { background: var(--pink); }
.page:nth-child(4n+3) figure { background: var(--yellow); }
.page:nth-child(4n+4) figure { background: var(--sky); }
.page .tag { display: inline-block; font-weight: 900; font-size: 0.8em; letter-spacing: 0.08em; padding: 3px 14px; border: 3px solid var(--ink); border-radius: var(--wonk2); background: var(--white); color: var(--ink); transform: rotate(-3deg); margin-bottom: 14px; }
.hill .page .say { color: var(--white); }

/* ---- the stripes between things ---- */
.candy { height: clamp(22px, 3vw, 34px); border-block: 4px solid var(--ink); background: repeating-linear-gradient(-55deg, var(--yellow) 0 26px, var(--pink) 26px 52px, var(--teal) 52px 78px, var(--white) 78px 104px); }

/* ---- the buttons: fat, crooked, pressable ---- */
.buttons { display: grid; gap: 26px; margin: 28px 0 40px; }
@media (min-width: 720px) { .buttons { grid-template-columns: 1fr 1fr; gap: 34px 30px; } .buttons .big { grid-column: 1 / -1; } }
.btn {
  display: flex; flex-direction: column; justify-content: center; min-height: clamp(96px, 12vw, 140px);
  padding: 16px 26px; border: 5px solid var(--ink); border-radius: var(--wonk); box-shadow: 8px 8px 0 var(--ink);
  font-size: clamp(32px, 5vw, 58px); font-weight: 900; letter-spacing: -0.04em; line-height: 0.95;
  color: var(--ink); text-decoration: none; transition: transform 0.12s, box-shadow 0.12s;
}
.cell:nth-child(odd) .btn { transform: rotate(-1.2deg); }
.cell:nth-child(even) .btn { transform: rotate(1deg); border-radius: var(--wonk2); }
.btn:hover { color: var(--ink); transform: translate(-3px, -3px) rotate(-2deg); box-shadow: 12px 12px 0 var(--ink); }
.btn:active { transform: translate(5px, 5px); box-shadow: 3px 3px 0 var(--ink); }
.btn:focus-visible { outline: 5px solid var(--pink); outline-offset: 5px; }
.b-try { background: var(--green); }
.b-install { background: var(--pink); }
.b-get { background: var(--white); }
.b-src { background: var(--sky); }
.b-read { background: var(--yellow); }
.big .btn { min-height: clamp(120px, 15vw, 180px); font-size: clamp(44px, 8vw, 96px); text-align: center; }
.btn .pkg { display: block; font-size: clamp(15px, 1.6vw, 19px); font-weight: 700; letter-spacing: 0; margin-top: 8px; overflow-wrap: anywhere; }
.note { margin: 16px 4px 0; font-size: 0.9em; }
.note code { display: inline-block; margin-top: 6px; }
.warn { background: var(--yellow); border: 4px solid var(--ink); border-radius: var(--wonk2); box-shadow: 6px 6px 0 var(--ink); font-weight: 800; font-size: clamp(18px, 2.1vw, 23px); line-height: 1.3; padding: 18px 24px; max-width: 34em; margin: 1.6em 0; transform: rotate(-0.6deg); }
.toc { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 30px; }
.toc a { text-decoration: none; color: var(--ink); background: var(--white); border: 3px solid var(--ink); border-radius: 999px; padding: 4px 16px; font-size: 0.88em; }
.toc a:hover { background: var(--yellow); color: var(--ink); }

/* ---- the grown-up's pages: the same paper, set straight ---- */
.grown h2 small { display: block; font-size: 0.26em; letter-spacing: 0; font-weight: 800; color: var(--grape); margin-top: 0.6em; line-height: 1.2; }
.rule { display: inline-block; background: var(--ink); color: var(--paper); font-weight: 800; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.25; padding: 10px 18px; border-radius: var(--wonk); max-width: 30em; margin: 0 0 1em; transform: rotate(-0.5deg); }
.card { background: var(--white); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 8px 8px 0 var(--ink); padding: 6px clamp(14px, 2.4vw, 28px); margin: 18px 0 26px; overflow: hidden; }
.grid { width: 100%; border-collapse: collapse; font-size: 0.86em; line-height: 1.4; }
.grid th { text-align: left; font-size: 0.78em; letter-spacing: 0.07em; text-transform: uppercase; color: var(--grape); padding: 14px 14px 8px 0; border-bottom: 4px solid var(--ink); font-weight: 900; }
.grid td { vertical-align: top; padding: 12px 14px 12px 0; border-bottom: 2px dashed rgba(42, 22, 80, 0.25); }
.grid tr:last-child td { border-bottom: 0; }
.grid td:nth-child(1) { font-weight: 700; white-space: nowrap; opacity: 0.7; }
.grid td:nth-child(2) { font-weight: 900; white-space: nowrap; }
.k-teal { color: #0E8F84; } .k-pink { color: #E0304B; } .k-green { color: #3F8F0F; } .k-yellow { color: #B07A00; } .k-purple { color: var(--grape); }
@media (max-width: 719px) {
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: auto; }
  .grid tr { padding: 12px 0; border-bottom: 2px dashed rgba(42, 22, 80, 0.25); }
  .grid tr:last-child { border-bottom: 0; }
  .grid td { border: 0; padding: 1px 0; white-space: normal !important; }
  .grid td:nth-child(1), .grid td:nth-child(2) { display: inline; }
  .grid td:nth-child(1)::after { content: " \2192  "; }
  .grid td:nth-child(2) { font-size: 1.2em; }
  .grid td:nth-child(n+3)::before { content: attr(data-l) ": "; font-weight: 800; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grape); }
}
.cols { display: grid; gap: 0 48px; }
@media (min-width: 900px) { .cols { grid-template-columns: 1fr 1fr; } }
.credit-list { padding: 0; margin: 20px 0; list-style: none; max-width: 46em; }
.credit-list li { padding: 12px 0; border-top: 2px dashed rgba(42, 22, 80, 0.25); }

/* ---- the back cover ---- */
.foot { margin-top: clamp(56px, 8vw, 100px); background: var(--ink); color: var(--paper); padding: 0 0 48px; font-size: 0.86em; }
.foot .candy { margin-bottom: 36px; border-top: 0; }
.foot b { color: var(--yellow); }
.foot p { max-width: 46em; }
