@font-face {
  font-family: "Didact Gothic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/didact-gothic.woff2") format("woff2");
}

:root {
  /* One card per screen. Swipe up and the next card snaps into place.
     White paper like the school sheet; a blue card starts each new sound. */
  --paper: #ffffff;
  --ink: #17191f;
  --sound: #2348c9;
  --tricky: #b0245c;
  --soft: #5d6577;
  --star: #f0a500;
  /* Reading face uses the round "a" and "g" children are taught in school. */
  --reading: "Didact Gothic", Futura, "Century Gothic", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------- Lesson cards ---------- */

main {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
}

main:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 6px var(--paper);
}

section {
  box-sizing: border-box;
  position: relative;
  height: 100%;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.word,
.mark,
.sentence,
.cheer {
  margin: 0;
  font-family: var(--reading);
  font-weight: 400;
  -webkit-text-stroke: 0.015em currentColor;
}

/* Each word card says how many letters it has (style="--n:4").
   The word is sized to fill the width; 0.75 is the widest a letter
   gets in this font ("m"), so no word can spill off the screen. */
.word {
  font-size: min(22vw, 28vh);
  font-size: min(calc((100vw - 40px) / (var(--n, 4) * 0.75)), 38vh);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.word .then {
  color: var(--sound);
  margin-left: 0.08em;
}

.sentence {
  font-size: min(11.5vw, 10vh);
  line-height: 1.35;
  text-wrap: balance;
}

.start {
  background: var(--sound);
  color: var(--paper);
}

/* The small label at the top of each card: Sounds, Words, Sentences, Tricky words. */
.part {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  margin: 0;
  font: 600 1rem/1 var(--body);
  opacity: 0.92;
}

.part.tricky {
  color: var(--tricky);
  opacity: 1;
}

.mark {
  font-size: min(50vw, 34vh);
  line-height: 1;
}

/* The example word under each sound. */
.example {
  margin: -12px 0 0;
  font-family: var(--reading);
  font-size: min(15vw, 9vh);
  line-height: 1;
  -webkit-text-stroke: 0.015em currentColor;
}

/* The page heading is for screen readers only. */
.hide {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.note {
  margin: 0;
  max-width: 30ch;
  font-size: 1.125rem;
  line-height: 1.45;
  text-wrap: balance;
  opacity: 0.92;
}

.star {
  display: block;
  width: min(30vw, 22vh);
  height: min(30vw, 22vh);
  color: var(--star);
}

.cheer {
  font-size: min(16vw, 14vh);
  line-height: 1.1;
}

.button {
  border-radius: 999px;
  padding: 16px 28px;
  background: var(--sound);
  color: var(--paper);
  font: 600 1.125rem/1 var(--body);
  text-decoration: none;
}

.button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* The small link back to the list. First card only; the last card has the button. */
.back {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 12px;
  color: inherit;
  font: 600 1rem/1 var(--body);
}

.back:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: -3px;
}

/* ---------- Home page ---------- */

.home {
  height: auto;
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}

.home main {
  box-sizing: border-box;
  max-width: 32rem;
  margin: 0 auto;
  padding: 24px 16px;
}

.home main {
  height: auto;
  overflow: visible;
}

.home h1 {
  margin: 8px 0 0;
  color: var(--sound);
  font-family: var(--reading);
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1;
  -webkit-text-stroke: 0.015em currentColor;
}

.home .sub {
  margin-top: 8px;
  font-size: 1.375rem;
  font-weight: 700;
}

.home h2 {
  margin: 32px 0 12px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.home p {
  margin: 16px 0 0;
  font-size: 1.125rem;
  line-height: 1.45;
}

.lessons {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lessons a {
  display: block;
  padding: 14px 20px 18px;
  border-radius: 16px;
  background: var(--sound);
  color: var(--paper);
  font-family: var(--reading);
  font-size: min(11vw, 3rem);
  line-height: 1.1;
  word-spacing: 0.4em;
  text-decoration: none;
  -webkit-text-stroke: 0.015em currentColor;
}

.lessons small {
  display: block;
  margin-bottom: 4px;
  font: 600 0.875rem/1.4 var(--body);
  opacity: 0.92;
  word-spacing: normal;
  -webkit-text-stroke: 0;
}

.lessons a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
