/*
 * Learnling's product page: the app's desk, paper and accents, a round friendly display face,
 * and the pixel buddies. These are the spellbook's colours; themes.css (made by build.ts from
 * the app's themes) swaps them all when another theme is picked.
 */

@font-face {
  font-family: 'Fredoka';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/fredoka-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/fredoka-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/fredoka-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Caveat';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/caveat-latin-600-normal.woff2') format('woff2');
}

:root {
  --desk: #241911;
  --desk-light: #33241a;
  --leather: #5b2b23;
  --paper: #f6ecd6;
  --paper-deep: #efe2c4;
  --note: #fbf3df;
  --ink: #2b2118;
  --ink-soft: #6e5a44;
  --cream: #f3e3c0;
  --cream-soft: #c9b48e;
  --wax: #a32c25;
  --quill: #2b4a8a;
  --on-cream: #2b2118;
  --button: #e3b54a;
  --on-button: #2b2118;
  --accent: #e3b54a;
  --display: 'Fredoka', 'Alegreya Sans', system-ui, sans-serif;
  --display-weight: 600;
  --body: 'Alegreya Sans', system-ui, sans-serif;
  --hand: 'Caveat', cursive;
  /* Stepped corners, the pixel way of rounding. */
  --notch: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px));
  color-scheme: dark;
}

/* Only the chosen language shows. */
html[data-lang='nl'] [lang='en']:not(html),
html[data-lang='en'] [lang='nl']:not(html) {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 70% -10%, color-mix(in oklab, var(--accent) 13%, transparent), transparent 60%),
    radial-gradient(900px 600px at 0% 40%, color-mix(in oklab, var(--quill) 14%, transparent), transparent 60%),
    var(--desk);
  transition: background-color 0.3s;
  color: var(--cream);
  font: 19px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--cream);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

canvas {
  image-rendering: pixelated;
  display: block;
}

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in oklab, var(--desk) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid color-mix(in oklab, var(--cream-soft) 15%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  font: 600 24px var(--display);
}

.brand img {
  image-rendering: auto;
}

.langs {
  display: flex;
  gap: 6px;
}

.langs button {
  font: 600 16px var(--display);
  min-width: 46px;
  height: 40px;
  border: 2px solid color-mix(in oklab, var(--cream) 40%, transparent);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  clip-path: var(--notch);
}

html[data-lang='nl'] [data-set-lang='nl'],
html[data-lang='en'] [data-set-lang='en'] {
  background: var(--cream);
  color: var(--on-cream);
  border-color: var(--cream);
}

main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

section {
  padding: clamp(48px, 8vw, 96px) 0 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: clamp(32px, 4.4vw, 48px);
  text-align: center;
  margin-bottom: 36px;
}

h2::after {
  content: '';
  display: block;
  width: 96px;
  height: 6px;
  margin: 16px auto 0;
  background: repeating-linear-gradient(90deg, var(--accent) 0 12px, transparent 12px 18px);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 24px var(--display);
  text-decoration: none;
  padding: 16px 28px 18px;
  color: var(--on-button);
  background: var(--button);
  border: 0;
  cursor: pointer;
  clip-path: var(--notch);
  box-shadow:
    inset 0 -6px 0 color-mix(in oklab, var(--button) 72%, black),
    inset 0 4px 0 color-mix(in oklab, var(--button) 70%, white);
  filter: drop-shadow(0 6px 0 color-mix(in oklab, var(--desk) 50%, black));
  transition: transform 0.08s, filter 0.08s;
}

.button:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 8px 0 color-mix(in oklab, var(--desk) 50%, black));
}

.button:active {
  transform: translateY(5px);
  filter: drop-shadow(0 1px 0 color-mix(in oklab, var(--desk) 50%, black));
}

.button::before {
  content: '';
  width: 20px;
  height: 22px;
  background: currentColor;
  /* A pixel arrow pointing down. */
  clip-path: polygon(30% 0, 70% 0, 70% 45%, 100% 45%, 50% 100%, 0 45%, 30% 45%);
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding-top: clamp(32px, 6vw, 72px);
}

.hero h1 {
  font-size: clamp(42px, 6.2vw, 76px);
  letter-spacing: -0.01em;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  text-shadow: 4px 4px 0 color-mix(in oklab, var(--leather) 70%, transparent);
}

.lead {
  font-size: clamp(19px, 2vw, 23px);
  color: var(--cream);
  max-width: 34em;
  margin: 22px 0 30px;
}

.fine {
  margin: 18px 0 0;
  font-size: 16px;
  color: var(--cream-soft);
}

.version:not(:empty)::before {
  content: ' · ';
}

.elsewhere[hidden] {
  display: none;
}

.elsewhere {
  margin: 12px 0 0;
  font-size: 16px;
  color: var(--cream);
  background: color-mix(in oklab, var(--wax) 25%, transparent);
  padding: 8px 12px;
  display: inline-block;
}

.hero-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 96px;
}

.buddies {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  margin-bottom: -10px;
  position: relative;
  z-index: 2;
}

.buddies canvas {
  cursor: pointer;
  margin: 0 -10px;
}

.books {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.books span {
  display: block;
  height: 22px;
  border-radius: 3px;
  box-shadow:
    inset 0 -4px 0 rgb(0 0 0 / 0.28),
    0 3px 0 rgb(0 0 0 / 0.3);
}

.books span:nth-child(1) {
  width: 86%;
  background: #6b2b2b;
}

.books span:nth-child(2) {
  width: 100%;
  background: #2f4a6b;
}

.books span:nth-child(3) {
  width: 92%;
  background: #56622c;
}

.hero-stage .books {
  width: min(100%, 560px);
}

.hint {
  margin: 14px 0 0;
  font: 600 22px var(--hand);
  color: var(--cream-soft);
}

/* Speech bubbles */

.bubble {
  position: absolute;
  top: 0;
  z-index: 3;
  max-width: 260px;
  padding: 12px 16px;
  background: var(--note);
  color: var(--ink);
  font: 600 22px/1.15 var(--hand);
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 rgb(0 0 0 / 0.35);
  transform: translateX(-50%);
  transition: left 0.25s, opacity 0.2s;
}

.bubble:empty {
  opacity: 0;
}

/* The tail: an ink triangle with a paper one inside, pointing down at whoever talks. */
.bubble::before,
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: translateX(-50%);
}

.bubble::before {
  bottom: -17px;
  width: 22px;
  height: 17px;
  background: var(--ink);
}

.bubble::after {
  bottom: -11px;
  width: 14px;
  height: 11px;
  background: var(--note);
}

/* Feature cards */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.card {
  background: var(--paper);
  color: var(--ink);
  padding: 26px 24px 24px;
  clip-path: var(--notch);
  filter: drop-shadow(0 6px 0 rgb(0 0 0 / 0.35));
  transform: rotate(-0.8deg);
  transition: transform 0.15s;
}

.card:nth-child(even) {
  transform: rotate(0.9deg);
}

.card:hover {
  transform: rotate(0) translateY(-4px);
}

.card canvas {
  margin-bottom: 14px;
}

.card h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.card p {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
}

/* The app in a window */

.window {
  margin: 0 auto;
  max-width: 1000px;
  background: var(--leather);
  padding: 0 10px 10px;
  clip-path: var(--notch);
  filter: drop-shadow(0 12px 0 rgb(0 0 0 / 0.35));
  transform: rotate(-0.6deg);
}

.window-bar {
  display: flex;
  gap: 8px;
  padding: 10px 4px;
}

.window-bar i {
  width: 12px;
  height: 12px;
  background: var(--cream-soft);
  opacity: 0.6;
}

.window img {
  display: block;
  width: 100%;
  height: auto;
}

/* Pick your theme: each button shows the theme's ground, a page and its button colour, with a
   buddy in the theme's headwear and the name in the theme's own heading face. */

.themes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto 40px;
}

.theme {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  clip-path: var(--notch);
  filter: drop-shadow(0 5px 0 rgb(0 0 0 / 0.3));
  transition: transform 0.12s;
}

.theme:hover {
  transform: translateY(-3px);
}

.theme[aria-pressed='true'] {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 3px var(--ink);
}

.theme-preview {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 108px;
  padding: 6px 8px 0;
  overflow: hidden;
}

.theme-page {
  flex: 1;
  min-width: 0;
  height: 40px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
}

.theme-page i {
  display: block;
  height: 5px;
  border-radius: 3px;
  width: 80%;
}

.theme-page i + i {
  width: 50%;
}

.theme-preview b {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-bottom: 14px;
}

.theme-name {
  font-size: 19px;
  line-height: 1.1;
  padding: 0 4px 4px;
}

/* What the buddies stand on: books in the spellbook, and each theme's own ground. */

html[data-theme='garden'] .books span {
  background: #7a4f2c;
}
html[data-theme='garden'] .books span:nth-child(1) {
  border-radius: 999px 999px 3px 3px;
  background: #94623a;
}
html[data-theme='ocean'] .books span {
  background: #dcbf82;
}
html[data-theme='ocean'] .books span:nth-child(1) {
  border-radius: 999px 999px 3px 3px;
  background: #e9cf96;
}
html[data-theme='space'] .books span {
  background: #222b55;
}
html[data-theme='space'] .books span:nth-child(1) {
  background: #2b3566;
  border-top: 4px solid #ff9a3c;
}
html[data-theme='quest'] .books span {
  border-radius: 0;
  border: 3px solid #0e0820;
  background: #ffd23f;
  box-shadow: inset -5px -5px 0 #c99a2e, inset 5px 5px 0 #ffe98a;
}
html[data-theme='notebook'] .books span {
  border: 2px solid #2b2b33;
  box-shadow: none;
}
html[data-theme='notebook'] .books span:nth-child(1) {
  background: #b3d4ff;
}
html[data-theme='notebook'] .books span:nth-child(2) {
  background: #ffb3a7;
}
html[data-theme='notebook'] .books span:nth-child(3) {
  background: #c6ebc0;
}

/* Pick your buddy */

.intro {
  text-align: center;
  max-width: 36em;
  margin: -12px auto 32px;
  font-size: 20px;
}

.picker {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}

.pick-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 90px;
}

.pick-stage canvas {
  position: relative;
  z-index: 2;
  margin-bottom: -16px;
  cursor: pointer;
}

.pick-stage .books {
  width: min(100%, 320px);
}

.pick-controls {
  background: var(--paper);
  color: var(--ink);
  padding: 22px 24px;
  clip-path: var(--notch);
  filter: drop-shadow(0 6px 0 rgb(0 0 0 / 0.35));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.choice-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 12px;
}

.label {
  font: 600 18px var(--display);
  color: var(--ink-soft);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choices button {
  font: 600 17px var(--display);
  color: var(--ink);
  background: var(--paper-deep);
  border: 2px solid color-mix(in oklab, var(--ink) 25%, transparent);
  padding: 8px 12px;
  cursor: pointer;
  clip-path: var(--notch);
}

.choices button[aria-pressed='true'] {
  background: var(--button);
  color: var(--on-button);
  border-color: var(--ink);
}

.species {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.species button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px 8px;
  font-size: 15px;
}

.swatches button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 3px solid color-mix(in oklab, var(--ink) 25%, transparent);
}

.swatches button[aria-pressed='true'] {
  border-color: var(--ink);
  outline: 3px solid var(--paper);
  outline-offset: -7px;
}

#pick-name {
  font: 600 28px var(--hand);
  color: var(--quill);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  padding: 2px 4px;
  width: 100%;
  max-width: 280px;
  outline: none;
}

/* Steps */

.steps {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.steps li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  align-items: center;
}

.steps b {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  font: var(--display-weight) 34px var(--display);
  color: var(--on-button);
  background: var(--button);
  clip-path: var(--notch);
  box-shadow: inset 0 -5px 0 color-mix(in oklab, var(--button) 72%, black);
}

.steps p {
  margin: 0;
  font-size: 20px;
}

.steps q {
  font-style: italic;
}

.note {
  text-align: center;
  color: var(--cream-soft);
  margin: 30px auto 0;
  max-width: 40em;
}

/* Parents */

.parents ul {
  list-style: none;
  margin: 0 auto;
  padding: 30px 32px;
  max-width: 820px;
  background: var(--note);
  color: var(--ink);
  clip-path: var(--notch);
  filter: drop-shadow(0 6px 0 rgb(0 0 0 / 0.35));
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: rotate(0.4deg);
}

.parents b {
  font-family: var(--display);
  font-weight: 600;
}

.parents a {
  color: var(--quill);
}

footer {
  text-align: center;
  padding: 72px 16px 40px;
  color: var(--cream-soft);
  font-size: 17px;
}

footer p {
  margin: 4px 0;
}

footer .small {
  font-size: 14px;
  opacity: 0.8;
}

/* Twinkling pixel sparkles in the background of the hero. */

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow:
    6px 0 var(--accent),
    -6px 0 var(--accent),
    0 6px var(--accent),
    0 -6px var(--accent);
  animation: twinkle 2.8s steps(4) infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 0.9;
  }
}

/* Small screens */

@media (max-width: 900px) {
  .hero,
  .picker {
    grid-template-columns: 1fr;
  }
  .hero-text {
    text-align: center;
  }
  .lead {
    margin-inline: auto;
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .themes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    font-size: 18px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .choice-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .species {
    grid-template-columns: repeat(3, 1fr);
  }
  .themes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .button {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
