/* Connectrio Maths at Home (parents' edition).
   Playful and warm: chunky toy-cube shapes, the three cube colours, soft bouncy cards. */
@font-face {
  font-family: 'Nunito';
  src: url('../assets/fonts/nunito-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 900; font-style: normal; font-display: swap;
}
:root {
  --red: #EB090A; --yellow: #F2B705; --blue: #2575CE;
  --red-dk: #A80607; --yellow-dk: #B98A00; --blue-dk: #164F91;
  --red-soft: #FFE3DF; --yellow-soft: #FFF0C2; --blue-soft: #DDEBFC;
  --red-ink: #C40708; --blue-ink: #1B5DA8;
  --bg: #FFF8EC; --page: #2575CE; --on-page: #FFFFFF; --b-edge: #FFFFFF; --bg-dot: rgba(37,117,206,.10); --card: #FFFFFF; --ink: #1B2540; --muted: #4E5A76; --line: #F0E4CC;
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red-soft: #45202A; --yellow-soft: #43381A; --blue-soft: #1C3152;
    --red-ink: #FF8A80; --blue-ink: #9CCBFF;
    --bg: #141A33; --page: #141A33; --on-page: #BCC6DA; --b-edge: var(--blue); --bg-dot: rgba(140,192,255,.10); --card: #1F2744; --ink: #F2F5FB; --muted: #BCC6DA; --line: #2E3858;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red-soft: #45202A; --yellow-soft: #43381A; --blue-soft: #1C3152;
  --red-ink: #FF8A80; --blue-ink: #9CCBFF;
  --bg: #141A33; --page: #141A33; --on-page: #BCC6DA; --b-edge: var(--blue); --bg-dot: rgba(140,192,255,.10); --card: #1F2744; --ink: #F2F5FB; --muted: #BCC6DA; --line: #2E3858;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 600 17px/1.5 var(--font);
  background: var(--page);
}
main { max-width: 640px; margin: 0 auto; padding: 6px max(16px, env(safe-area-inset-left)) 48px; overflow-x: clip; }
h1, h2 { margin: 0; line-height: 1.15; font-weight: 900; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: none; }
svg { display: block; }
.cubes { display: none; }

/* ---------- home ---------- */
.hero { position: relative; text-align: center; padding: 34px 6px 26px; }
.logo { width: min(250px, 72%); height: auto; position: relative; z-index: 1; background: #fff; border-radius: 18px; padding: 10px 14px; border: 3px solid #fff; box-shadow: 0 6px 0 var(--blue-dk); }
.hero h1 { margin-top: 14px; font-size: 32px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tile { display: inline-block; padding: 4px 14px 6px; border-radius: 14px; color: #fff; border: 3px solid #fff; }
.tile:nth-child(1) { transform: rotate(-4deg); } .tile:nth-child(2) { transform: translateY(-4px) rotate(3deg); } .tile:nth-child(3) { transform: rotate(-2deg); }
.t-R { background: var(--red); box-shadow: 0 5px 0 var(--red-dk); }
.t-Y { background: var(--yellow); color: #1B2540; box-shadow: 0 5px 0 var(--yellow-dk); }
.t-B { background: var(--blue); box-shadow: 0 5px 0 var(--blue-dk); }
.hero p { margin: 18px auto 0; max-width: 22em; font-size: 18px; font-weight: 800; color: var(--on-page); }
.float { position: absolute; width: 34px; height: 34px; animation: bob 3.2s ease-in-out infinite; }
.float svg { width: 100%; height: 100%; }
.f1 { left: 2%; top: 30px; transform: rotate(-14deg); }
.f2 { right: 4%; top: 18px; width: 28px; height: 28px; animation-delay: -1.1s; }
.f3 { left: 6%; top: 150px; width: 24px; height: 24px; animation-delay: -2s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }

.boards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 600px) { .boards { grid-template-columns: 1fr 1fr; } }
.boards li:nth-child(odd) .board-card { rotate: -.8deg; } .boards li:nth-child(even) .board-card { rotate: .8deg; }
.board-card {
  position: relative; display: flex; align-items: center; gap: 14px; height: 100%; text-decoration: none;
  border-radius: 26px; padding: 10px 14px 10px 10px; border: 4px solid; background: var(--card);
  transition: transform .15s cubic-bezier(.3, 1.6, .5, 1), box-shadow .15s;
}
.board-card.c-R { border-color: var(--red); box-shadow: 0 7px 0 var(--red-dk); }
.board-card.c-Y { border-color: var(--yellow); box-shadow: 0 7px 0 var(--yellow-dk); }
.board-card.c-B { border-color: var(--b-edge); box-shadow: 0 7px 0 var(--blue-dk); }
.board-card:hover { transform: translateY(-3px); }
.board-card:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
/* Each picture is the real page, landscape or portrait, and all six are drawn at the same
   paper size: the long side of every A4 page is the full width of the square. */
.board-card .thumb { flex: 0 0 56%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 8px; border-radius: 18px; }
/* frames use the two blues of the Connectrio lettering, shaded light to dark like the logo */
.board-card .thumb { background: linear-gradient(#3E8EE6, #2F64C0); box-shadow: inset 0 -6px 0 rgba(20,50,110,.35); }
.thumb svg { background: #fff; border-radius: 6px; box-shadow: 0 4px 0 rgba(27,37,64,.28); }
.board-card .thumb.land svg { width: 100%; height: auto; aspect-ratio: 297 / 210; }
.board-card .thumb.port svg { height: 100%; width: auto; aspect-ratio: 210 / 297; }
.board-card .name { display: block; flex: 1; font-weight: 900; font-size: 20px; line-height: 1.2; }
.cluster { position: absolute; top: -18px; right: -12px; width: 58px; height: 50px; pointer-events: none; }
.cluster .cube { position: absolute; width: 26px; height: 26px; filter: drop-shadow(0 2px 0 rgba(27,37,64,.35)); }
.cluster .q1 { left: 0; bottom: 0; rotate: -8deg; } .cluster .q2 { right: 0; bottom: 2px; rotate: 10deg; } .cluster .q3 { left: 15px; top: 0; rotate: 4deg; }

.safety { margin-top: 34px; color: var(--muted); font-size: 15px; background: var(--card); border-radius: 20px; padding: 0 16px; border: 2px dashed var(--line); }
.safety[open] { padding-bottom: 14px; }
.safety summary { cursor: pointer; font-weight: 800; min-height: 48px; display: flex; align-items: center; justify-content: center; list-style: none; }
.safety summary::-webkit-details-marker { display: none; }
.safety p { margin-top: 8px; }

/* ---------- board page ---------- */
.back, .home-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px 0 10px; margin: 8px 0 14px;
  font-weight: 900; text-decoration: none; color: var(--ink); background: var(--card);
  border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink);
}
.back:active, .home-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.back svg { width: 22px; height: 22px; }
.home-btn { margin: 34px auto 0; display: flex; width: max-content; padding: 0 20px 0 10px; }
.home-btn .cube { width: 26px; height: 26px; }

.board-head { position: relative; display: flex; gap: 14px; align-items: center; border-radius: 28px; padding: 16px; margin-bottom: 6px; border: 4px solid; }
.h-R { background: var(--red-soft); border-color: var(--red); } .h-Y { background: var(--yellow-soft); border-color: var(--yellow); } .h-B { background: var(--blue-soft); border-color: var(--b-edge); }
.board-head .thumb { flex: 0 0 auto; rotate: -4deg; }
.board-head .thumb.land svg { width: 120px; height: auto; aspect-ratio: 297 / 210; }
.board-head .thumb.port svg { width: 76px; height: auto; aspect-ratio: 210 / 297; }
.board-head h1 { font-size: 25px; }
.board-head p { margin-top: 6px; font-size: 16px; font-weight: 700; }

.idea { margin-top: 30px; background: var(--card); border: 4px solid; border-radius: 28px; overflow: hidden; }
.idea.k-R { border-color: var(--red); box-shadow: 0 8px 0 var(--red-dk); }
.idea.k-Y { border-color: var(--yellow); box-shadow: 0 8px 0 var(--yellow-dk); }
.idea.k-B { border-color: var(--b-edge); box-shadow: 0 8px 0 var(--blue-dk); }
.idea-head { font-size: 22px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.k-R .idea-head { background: var(--red-soft); } .k-Y .idea-head { background: var(--yellow-soft); } .k-B .idea-head { background: var(--blue-soft); }
.idea-body { padding: 2px 14px 20px; }
.num { flex: 0 0 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; color: #fff; rotate: -6deg; position: relative; overflow: hidden; }
.num::after { content: ''; position: absolute; left: 7px; right: 7px; top: 5px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.45); }
.n-R { background: var(--red); box-shadow: inset 0 -6px 0 var(--red-dk); }
.n-Y { background: var(--yellow); color: #1B2540; box-shadow: inset 0 -6px 0 var(--yellow-dk); }
.n-B { background: var(--blue); box-shadow: inset 0 -6px 0 var(--blue-dk); }

.why { margin-top: 14px; font-size: 16px; font-weight: 700; background: var(--yellow-soft); border-radius: 16px; padding: 10px 14px; }
.why strong { display: block; font-weight: 900; color: var(--ink); }
.challenge { margin-top: 16px; text-align: center; background: var(--blue-soft); border: 3px dashed var(--blue); border-radius: 22px; padding: 14px 12px 18px; }
.challenge p { font-weight: 800; font-size: 17px; }
.challenge .big { display: block; font-size: 56px; font-weight: 900; line-height: 1.1; letter-spacing: .03em; color: #1B2540; }
.challenge.done { padding-bottom: 12px; }
.again.check { margin-top: 10px; background: var(--blue); color: #fff; }
.pics { margin-top: 16px; display: grid; gap: 14px; }
.pics.many { grid-auto-flow: column; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: thin; }
.pics.many figure { scroll-snap-align: start; }
figure { margin: 0; position: relative; }
.paper { background: #fff; border-radius: 22px; padding: 10px; border: 3px solid #1B2540; box-shadow: 0 5px 0 #1B2540; }
.paper svg { width: 100%; height: auto; max-height: 360px; }
.sum { margin: 12px 0 0; display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; color: #1B2540; border: 3px dashed #1B2540; border-radius: 16px; padding: 8px 12px; font-variant-numeric: tabular-nums; }
.sum span { white-space: nowrap; }
.calc { white-space: nowrap; }
.sum .main { font-size: 26px; font-weight: 900; letter-spacing: .02em; }
.sum .sub { font-size: 18px; font-weight: 800; color: #4E5A76; }
figcaption { font-size: 15px; font-weight: 700; color: var(--muted); margin-top: 10px; padding: 0 4px; }
.step { position: absolute; top: 10px; left: 10px; z-index: 1; width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: #1B2540; border: 3px solid #1B2540; font-weight: 900; display: grid; place-items: center; font-size: 15px; }
.swipe { font-size: 14px; font-weight: 900; color: var(--blue-ink); margin-top: 2px; }
@media (min-width: 560px) { .pics.many { grid-auto-columns: 48%; } }

.ask { display: flex; align-items: flex-end; gap: 10px; margin-top: 16px; }
.ask-face { flex: 0 0 44px; height: 44px; }
.ask-face svg { width: 100%; height: 100%; }
.bubble { position: relative; flex: 1; font-size: 18px; font-weight: 700; background: var(--card); border: 3px solid var(--blue); border-radius: 22px 22px 22px 6px; padding: 10px 14px 12px; }
.bubble strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }

.again {
  margin-top: 16px; font: 900 16px var(--font); color: #1B2540; background: var(--yellow);
  border: 3px solid #1B2540; border-radius: 999px; min-height: 50px; padding: 0 20px 0 14px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; box-shadow: 0 5px 0 #1B2540;
  transition: transform .1s, box-shadow .1s;
}
.again svg { width: 22px; height: 22px; }
.again:active { transform: translateY(4px); box-shadow: 0 1px 0 #1B2540; }

.divider { display: flex; justify-content: center; gap: 8px; margin: 28px 0 4px; }
.divider .cube { width: 18px; height: 18px; filter: drop-shadow(0 0 1.5px #fff); }
.divider .cube:nth-child(even) { translate: 0 -4px; }

.fresh { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }

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