@font-face {
  font-family: Barlow Condensed;
  src: url("assets/barlow-condensed-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: DM Sans;
  src: url("assets/dm-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #fff9ed;
  --ink: #282643;
  --blue: #414bb7;
  --red: #c53e35;
  --line: #dfd6c8;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --round: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, p, ul { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 800; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
[tabindex="-1"]:focus { outline: none; }
.shell { width: min(100% - 2.5rem, 71rem); margin-inline: auto; }
main.shell { padding-bottom: 2rem; }

.site-header { border-bottom: 1px solid var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.875rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font: 800 2rem/1 var(--display);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.2rem;
  aspect-ratio: 1;
  margin-right: .55rem;
  border: 2px solid var(--ink);
  border-radius: .65rem;
  background: #ffcc58;
  box-shadow: 1px 2px var(--ink);
  transform: rotate(-8deg);
  font-size: 1.6rem;
}

.brand-dot, .hero h1 span { color: var(--red); }

.topics-link {
  display: grid;
  place-content: center;
  min-height: 44px;
  padding: .35rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  font-weight: 700;
  text-decoration: none;
}

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  min-height: 20.75rem;
  margin-top: 1.75rem;
  background: #e9e9ff;
  border: 2px solid var(--ink);
  border-radius: 1.9rem;
  box-shadow: 0 5px var(--ink);
  overflow: hidden;
}

.hero-copy { padding: 2rem 0 2.25rem clamp(1.25rem, 5vw, 4.5rem); }

.hero h1 {
  font-size: clamp(4rem, 9vw, 7.25rem);
  line-height: .92;
  letter-spacing: -.018em;
}

.hero p {
  max-width: 29ch;
  margin-top: 1.15rem;
  font-size: clamp(1.02rem, 2vw, 1.25rem);
  font-weight: 600;
}

.hero-art {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: end;
  align-self: stretch;
  min-width: 0;
}

.hero-art::before {
  content: "";
  position: absolute;
  inset: auto auto 10% 50%;
  width: 72%;
  aspect-ratio: 1.2;
  translate: -50% 0;
  border-radius: 50%;
  background: #d9dafd;
  z-index: -1;
}

.hero-art img { width: min(100%, 20rem); height: auto; margin-block: .85rem; display: block; }

.topics { margin-top: 2.6rem; }
.topics h2, .deck-heading h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); line-height: 1; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .95rem;
  list-style: none;
  margin-top: 1.05rem;
  padding: 0;
}

[data-topic="letters"] { --card-color: #ffdbd5; --accent: #a92d38; }
[data-topic="numbers"] { --card-color: #ffe5a4; --accent: #774308; }
[data-topic="colors"] { --card-color: #d8e6ff; --accent: #2a4fa4; }
[data-topic="shapes"] { --card-color: #f0ddfb; --accent: #66399b; }
[data-topic="animals"] { --card-color: #ddf0ce; --accent: #2e6451; }
[data-topic="words"] { --card-color: #ffe2c8; --accent: #aa482b; }

.topic-link {
  display: grid;
  grid-template-rows: 4.7rem auto;
  align-items: center;
  height: 100%;
  min-height: 8.85rem;
  padding: .65rem .25rem .8rem;
  border: 2px solid var(--ink);
  border-radius: 1.1rem;
  box-shadow: 0 4px var(--ink);
  background: var(--card-color);
  text-align: center;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.topic-label { font: 800 clamp(1.25rem, 2.4vw, 1.85rem)/1 var(--display); }
.topic-art { display: grid; place-items: center; color: var(--accent); }
.topic-art > span { font: 800 clamp(2.2rem, 4.6vw, 3.35rem)/1 var(--round); letter-spacing: -.065em; }
.topic-art .color-chip { width: 2.85rem; border-width: 2px; box-shadow: .65rem .28rem 0 .05rem #f9bf53, -.65rem .28rem 0 .05rem #8f85d6; }
.topic-art .shape { width: 3.3rem; }
.topic-art .illustration { width: 4.6rem; }
.topics-link:hover, .card-controls button:hover { background: #e9e9ff; }
.topic-link:hover, .learning-card:hover { transform: translateY(-2px); box-shadow: 0 6px var(--ink); }
.topic-link:active, .learning-card:active, .card-controls button:active { transform: translateY(2px); box-shadow: 0 2px var(--ink); }

.deck { max-width: 48rem; margin: 2rem auto 0; }

.deck-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.1rem;
}

.card-position { color: #5f5973; font-weight: 700; white-space: nowrap; }

.learning-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: .65rem;
  width: 100%;
  min-height: clamp(19rem, 56svh, 28rem);
  padding: 1.15rem;
  border: 2px solid var(--ink);
  border-radius: 1.65rem;
  box-shadow: 0 4px var(--ink);
  background: var(--card-color);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.card-visual { display: grid; place-items: center; width: 100%; min-height: 9rem; }
.card-visual:empty { display: none; }

.card-label {
  display: block;
  font: 800 clamp(2.75rem, 7vw, 4.45rem)/1 var(--round);
  overflow-wrap: anywhere;
}

.deck[data-topic="letters"] .card-label, .numeral {
  font: 800 clamp(6.7rem, 24vw, 12rem)/.95 var(--round);
  letter-spacing: -.065em;
  color: var(--accent);
}

.numeral { font-size: clamp(5rem, 19vw, 9rem); }

.count-dots {
  display: grid;
  grid-template-columns: repeat(var(--columns), 1.125rem);
  gap: .35rem;
  justify-content: center;
  margin: .9rem 0 .25rem;
}

.count-dots span { aspect-ratio: 1; border-radius: 50%; background: var(--accent); }

.listen {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  min-height: 2.35rem;
  padding: .35rem .85rem;
  margin-top: .3rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--accent);
  font-weight: 800;
}

.sound-icon {
  position: relative;
  width: 1.08rem;
  height: .95rem;
}

.sound-icon::before {
  content: "";
  position: absolute;
  inset: 0 .45rem 0 0;
  background: currentColor;
  clip-path: polygon(0 32%, 34% 32%, 100% 0, 100% 100%, 34% 68%, 0 68%);
}

.sound-icon::after {
  content: "";
  position: absolute;
  inset: .08rem 0 .08rem .48rem;
  border-right: 2px solid currentColor;
  border-radius: 50%;
}

.card-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin-top: 1.25rem; }

.card-controls button {
  min-height: 3.5rem;
  border: 2px solid var(--ink);
  border-radius: .85rem;
  box-shadow: 0 3px var(--ink);
  background: #fffdf8;
  font-size: 1.1rem;
  font-weight: 800;
}

.card-controls #next { background: var(--ink); color: #fff9ed; }
.card-controls #next:hover { background: var(--blue); }
.audio-status:not(:empty) { margin-top: 1rem; font-weight: 700; }

.color-chip {
  display: block;
  width: 8.6rem;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--swatch);
}

.shape { display: block; width: 8.65rem; aspect-ratio: 1; background: var(--accent); }
.shape-circle, .shape-oval { border-radius: 50%; }
.shape-oval { aspect-ratio: 1.52; }
.shape-rectangle { aspect-ratio: 1.65; }
.shape-triangle { clip-path: polygon(50% 0, 100% 94%, 0 94%); }
.shape-diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape-star { clip-path: polygon(50% 0, 63% 35%, 100% 38%, 72% 62%, 81% 100%, 50% 78%, 19% 100%, 28% 62%, 0 38%, 37% 35%); }
.shape-heart {
  background: none;
  position: relative;
  height: auto;
}
.shape-heart::before, .shape-heart::after {
  content: "";
  position: absolute;
  inset: 5% auto auto 50%;
  width: 50%;
  height: 80%;
  background: var(--accent);
  border-radius: 50% 50% 0 0;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
}
.shape-heart::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

.illustration { display: block; width: min(100%, 13rem); height: auto; aspect-ratio: 1; object-fit: contain; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 55rem) {
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 40rem) {
  .shell { width: calc(100% - 1.5rem); }
  .header-inner { min-height: 3.85rem; }
  .brand { font-size: 1.75rem; }
  .brand-mark { width: 1.95rem; font-size: 1.4rem; }
  .topics-link { padding-inline: .75rem; }
  .hero { min-height: 11.6rem; margin-top: .9rem; border-radius: 1.3rem; grid-template-columns: 1.25fr .75fr; }
  .hero-copy { padding: .95rem 0 .95rem .95rem; }
  .hero h1 { font-size: clamp(2.6rem, 10vw, 4.8rem); }
  .hero p { margin-top: .65rem; }
  .hero-art { align-items: center; }
  .hero-art img { width: 122%; max-width: none; margin-left: -22%; margin-block: 0; }
  .topics { margin-top: 1.7rem; }
  .topic-grid { gap: .65rem; margin-top: .85rem; }
  .topic-link { min-height: 6.6rem; grid-template-rows: 3.35rem auto; border-radius: .85rem; }
  .topic-art .illustration { width: 3.6rem; }
  .topic-art .shape { width: 2.45rem; }
  .topic-art .color-chip { width: 2.1rem; }
  .deck { margin-top: 1.1rem; }
}

@media (max-width: 22rem) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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