/* LearnFutura "fridge door" style: every page is a fridge door, tools are
   papers and drawings held up with magnets. Shared by the dashboard,
   materials workspace, and Maths Worksheet Builder. */
/* Fonts are hosted with the site (SIL Open Font License, see fonts/). */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("fonts/fredoka-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: "Fredoka";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("fonts/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/nunito-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: "Nunito";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Gaegu";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/gaegu-400.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: "Gaegu";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/gaegu-700.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 {
  --kitchen: #d9e4ec;
  --enamel: #f7f8f6;
  --ink: #24306b;
  --muted: #56628a;
  --border: #dde3ea;
  --pen: #3550d8;
  --accent: #3550d8;
  --red: #ef4b4b;
  --orange: #ff9b2f;
  --yellow: #ffd23f;
  --green: #3fb67e;
  --blue: #3a7bf2;
  --violet: #8a5cf0;
  --pink: #ff6fae;
  --display: "Fredoka", ui-rounded, "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --hand: "Gaegu", "Chalkboard SE", "Comic Sans MS", cursive;
  --paper-shadow: 0 1px 0 #0000000d, 0 16px 22px -16px #1a2b4a88;
  font-family: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--kitchen);
  background-image: linear-gradient(90deg, #ffffff40 1px, transparent 1px), linear-gradient(#ffffff40 1px, transparent 1px);
  background-size: 64px 64px;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
pre:focus-visible {
  outline: 3px solid var(--pen);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
  opacity: .5;
}

/* The fridge door wraps every page. `.page` stays for print rules. */
.fridge {
  position: relative;
  max-width: 1240px;
  margin: 28px auto 0;
  padding: 30px 52px 60px 88px;
  border-radius: 34px 34px 0 0;
  background: linear-gradient(100deg, #fff 0%, var(--enamel) 40%, #eceeed 100%);
  box-shadow: inset -10px 0 30px #00000010, inset 0 2px 0 #fff, 0 30px 60px -30px #1a2b4a66, 0 0 0 1px #d5d9db;
}

.fridge.wide {
  max-width: min(1600px, calc(100% - 40px));
}

.fridge-handle {
  position: absolute;
  left: 30px;
  top: 70px;
  width: 20px;
  height: 300px;
  border-radius: 10px;
  background: linear-gradient(90deg, #c9ced2, #f4f6f7 40%, #aeb4b9);
  box-shadow: 3px 6px 10px #0002;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.magnet-logo {
  display: inline-flex;
  gap: 1px;
}

.magnet-logo span,
.magnet {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1;
  color: var(--c);
  transform: rotate(var(--r, 0deg));
}

.magnet-logo span {
  font-size: 2rem;
  text-shadow: 1px 3px 0 color-mix(in srgb, var(--c) 70%, black);
}

.site-header nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: .9rem;
  box-shadow: 0 3px 0 #d3d8dc, 0 6px 10px -4px #0003;
  transition: transform .15s;
}

.site-header nav a::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, var(--pen));
}

.site-header nav a:hover {
  transform: translateY(-2px);
}

.site-header nav a.active,
.site-header nav a[aria-current="page"] {
  background: var(--c, var(--pen));
  color: #fff;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c, var(--pen)) 65%, black);
}

.site-header nav a.active::before,
.site-header nav a[aria-current="page"]::before {
  background: #fff;
}

.hint {
  font-family: var(--hand);
  font-size: 1.25rem;
  color: #6f7890;
}

.crumbs {
  margin-top: 18px;
  font-family: var(--hand);
  font-size: 1.2rem;
  color: var(--muted);
}

.crumbs a {
  text-decoration: underline wavy var(--pen);
  text-underline-offset: 5px;
}

main {
  display: block;
}

.eyebrow {
  font-family: var(--hand);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pen);
}

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

h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 6px 0 14px;
}

h2 {
  font-size: 1.35rem;
  margin: 0 0 8px;
}

/* Paper held up by a magnet: the base for panels and cards. */
.paper {
  position: relative;
  background: #fffefa;
  box-shadow: var(--paper-shadow);
}

.pin {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff9 0 4px, var(--m, var(--red)) 5px);
  box-shadow: 0 4px 5px #0004;
  z-index: 2;
}

.pin.star {
  width: 44px;
  height: 44px;
  margin-left: -22px;
  top: -20px;
  border-radius: 0;
  background: var(--m, var(--yellow));
  box-shadow: none;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 4px 3px #0004);
}

.pin.heart {
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border-radius: 0;
  background: var(--m, var(--pink));
  box-shadow: none;
  clip-path: path("M20 36 C 4 24 0 16 0 10 A 10 10 0 0 1 20 6 A 10 10 0 0 1 40 10 C 40 16 36 24 20 36Z");
  filter: drop-shadow(0 4px 3px #0004);
}

/* ---------- Dashboard ---------- */
.magnets {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: .04em;
  /* "LearnFutura" is about 7.4em wide: scale it to the door so it always
     stays on one line, from small phones up to the 6.2rem desktop size. */
  font-size: clamp(1.1rem, calc((100vw - 96px) / 7.6), 6.2rem);
  margin: 26px 0 10px;
  user-select: none;
}

.magnets .magnet {
  flex: none;
  text-align: center;
  font-size: 1em;
  cursor: grab;
  touch-action: none;
  position: relative;
  text-shadow: 0 1px 0 #fff8, 0 -2px 0 #0000001f, 2px 5px 0 color-mix(in srgb, var(--c) 70%, black), 3px 10px 10px #0003;
  transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg));
  transition: transform .15s;
}

.magnets .gap {
  width: .35em;
}

.poetry {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 8px;
  max-width: 880px;
  margin: 18px 0 0;
  font-weight: 400;
}

.word {
  white-space: nowrap;
  background: #fff;
  padding: 6px 12px 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3.6vw, 2.6rem);
  line-height: 1;
  color: var(--ink);
  box-shadow: 0 2px 0 #e3e3e3, 2px 5px 8px -2px #0003;
  cursor: grab;
  touch-action: none;
  user-select: none;
  position: relative;
  transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg));
  transition: transform .15s;
}

.word.hl {
  background: var(--yellow);
}

.poetry.small .word {
  font-size: 1.15rem;
  padding: 5px 9px;
}

.dragging {
  cursor: grabbing;
  transition: none;
  z-index: 10;
}

/* On touch screens a vertical swipe still scrolls the page. */
@media (pointer: coarse) {
  .magnets .magnet,
  .word {
    touch-action: pan-y;
  }
}

.section-title {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 2.6rem;
  margin: 64px 0 28px;
}

.section-title span {
  background: linear-gradient(transparent 60%, #ffd23f99 60%);
  padding: 0 6px;
}

.section-title small {
  font-size: .6em;
  font-weight: 400;
  color: var(--muted);
}

/* The main heading's plain-words line under the magnet word tiles. */
.h1-line {
  flex-basis: 100%;
  margin-top: 6px;
  font-family: var(--hand);
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--pen);
}

.drawings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 46px 34px;
}

.drawing {
  display: block;
  padding: 18px 18px 20px;
  color: var(--ink);
  transform: rotate(var(--r, 0deg));
  transition: transform .25s;
}

.drawing:hover,
.drawing:focus-within {
  transform: rotate(0) translateY(-6px) scale(1.02);
  z-index: 3;
}

/* The tool name is the card's link or button; it covers the whole card so
   the card stays clickable, while search engines and screen readers get a
   heading with the tool's name as its link text. */
.drawing .name a,
.drawing .name button {
  color: inherit;
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.drawing svg.art {
  width: 100%;
  height: 150px;
  display: block;
  margin-bottom: 8px;
}

.drawing .name {
  display: block;
  margin: 0;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}

.drawing .cat {
  display: block;
  margin: 0 0 4px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.drawing .desc {
  display: block;
  margin: 6px 0 0;
  line-height: 1.45;
  font-weight: 500;
}

.drawing .go {
  display: block;
  margin-top: 10px;
  font-family: var(--hand);
  font-size: 1.2rem;
  color: var(--pen);
}

.drawing.big {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 22px;
  align-items: center;
}

.drawing.big svg.art {
  height: 230px;
}

.drawing.big .name {
  font-size: 2.8rem;
}

.crayon {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
  filter: url(#crayon);
}

.syllables {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

.syllables .a {
  color: #d1495b;
}

.syllables .b {
  color: #2f6fe4;
}

.fridge-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 64px;
  align-items: start;
}

.todo {
  padding: 30px 26px 26px;
  transform: rotate(-1deg);
  background-color: #fff;
  background-image: repeating-linear-gradient(transparent 0 31px, #cfe0f6 31px 32px);
  line-height: 32px;
}

.todo h2 {
  margin: 0;
  font-family: var(--hand);
  font-size: 2rem;
}

.todo ul {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  font-family: var(--hand);
  font-size: 1.5rem;
}

.todo li::before {
  content: "☐ ";
}

.todo li.done::before {
  content: "☑ ";
  color: var(--green);
}

.todo li.done {
  text-decoration: line-through;
  text-decoration-color: var(--red);
}

.todo p {
  margin: 10px 0 0;
  font-weight: 500;
  line-height: 1.5;
}

.todo a,
.stars a {
  color: var(--pen);
  font-weight: 800;
}

.stars {
  padding: 26px;
  transform: rotate(1.4deg);
  background: #fff;
}

.stars h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  color: var(--violet);
}

.stars table {
  width: 100%;
  border-collapse: collapse;
  font-weight: 700;
  font-size: .95rem;
}

.stars td {
  border: 2px solid #e2e6f3;
  padding: 8px;
}

.stars td:last-child {
  width: 3em;
  text-align: center;
  color: #e9b400;
  font-size: 1.4rem;
}

.stars p {
  margin: 12px 0 0;
  font-size: .92rem;
  line-height: 1.5;
  font-weight: 500;
}

.site-footer {
  text-align: center;
  padding: 26px 16px 40px;
  font-family: var(--hand);
  font-size: 1.4rem;
  color: #5b6890;
}

/* ---------- Not-found page ---------- */
.not-found {
  padding-bottom: 20px;
}

.not-found .magnets .magnet {
  cursor: default;
}

.not-found-text {
  max-width: 46ch;
  margin: 26px 0 18px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.not-found-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.not-found-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  box-shadow: 0 3px 0 #d3d8dc, 0 6px 10px -4px #0003;
}

.not-found-links a::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}

.not-found-links a:hover {
  transform: translateY(-2px);
}

/* ---------- Forms and buttons, shared by every tool ---------- */
label {
  display: block;
  font-size: .92rem;
  font-weight: 700;
  margin: 18px 0 8px;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid #d6dcea;
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--pen);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.field-hint {
  font-size: .82rem;
  color: var(--muted);
  margin: 8px 0;
}

.primary-button {
  background: var(--pen);
  border: 0;
  border-radius: 999px;
  color: white;
  padding: 12px 22px;
  font-weight: 800;
  font-size: .95rem;
  margin-top: 23px;
  box-shadow: 0 4px 0 #2235a0;
  transition: transform .1s, box-shadow .1s;
}

.primary-button:hover:enabled {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2235a0;
}

.secondary-button {
  border: 2px solid #d6dcea;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: .9rem;
  font-weight: 700;
}

.secondary-button:hover:enabled {
  border-color: var(--pen);
  color: var(--pen);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  line-height: 32px;
  background-color: #fff;
  background-image: repeating-linear-gradient(transparent 0 31px, #d9e6f6 31px 32px);
  border: 2px solid #e3e8f2;
  border-radius: 10px;
  padding: 0 18px 8px;
  font-size: .98rem;
}

/* ---------- Dashboard dialog: a sheet of paper on the fridge ---------- */
dialog {
  border: 0;
  border-radius: 6px;
  padding: 34px 32px 28px;
  width: min(620px, calc(100% - 32px));
  max-height: 90dvh;
  color: var(--ink);
  background: #fffefa;
  box-shadow: 0 30px 80px #1b173e40;
}

dialog::backdrop {
  background: #24306b80;
  backdrop-filter: blur(3px);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.dialog-heading h2 {
  font-size: 1.9rem;
  margin: 4px 0 0;
}

.close-button {
  background: #eef1f7;
  color: var(--ink);
  border: 0;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.5rem;
  flex: none;
}

.dialog-description {
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.65;
}

.result-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 25px;
}

.result-heading h3 {
  font-size: 1.15rem;
  margin: 0;
}

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

#status {
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--pen);
  line-height: 1.4;
  margin-bottom: 0;
}

.timer-display {
  font-family: var(--display);
  font-weight: 700;
  font-size: 5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 22px 0 10px;
  color: var(--red);
  text-shadow: 3px 6px 0 #ef4b4b33;
}

.timer-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.timer-actions .primary-button {
  margin-top: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .drawings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fridge-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .fridge {
    margin: 10px 8px 0;
    padding: 24px 16px 50px 40px;
    border-radius: 24px 24px 0 0;
  }
  .fridge-handle {
    left: 10px;
    width: 14px;
    height: 200px;
  }
  .magnet-logo span {
    font-size: 1.6rem;
  }
  /* Narrow screens: tiles wrap onto more rows, so give each row room and
     tilt the tiles less so they never overlap the row above or below. */
  .poetry {
    gap: 16px 6px;
  }
  .word {
    transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--tilt, 0deg));
  }
  .word:nth-child(odd) {
    --tilt: -1.5deg;
  }
  .word:nth-child(even) {
    --tilt: 1.5deg;
  }
  .poetry .word {
    font-size: clamp(1.25rem, 6.4vw, 1.6rem);
  }
  .poetry.small .word {
    font-size: clamp(.95rem, 4.2vw, 1.1rem);
  }
  .drawings {
    grid-template-columns: 1fr;
  }
  .drawing.big {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
  .section-title {
    font-size: 2.1rem;
  }
  dialog {
    padding: 26px 20px 22px;
  }
  .timer-display {
    font-size: 3.6rem;
  }
}

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