/* Cube Solver website. Plain CSS, no build step.
   Layout: a calm paper page; the one loud thing is the hero cube, one turn from solved.
   Every colour is a token; the sticker colours are the classic cube's and never change with the theme. */

@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --paper: #f5f6fd;
  --card: #ffffff;
  --ink: #151a3b;
  --muted: #555c86;
  --line: #dde1f5;
  --brand: #4357ee;
  --brand-soft: #e6e9ff;
  --on-brand: #ffffff;
  --body: #141722;            /* the plastic between stickers */
  --shadow: 0 1px 2px rgb(21 26 59 / 6%), 0 8px 24px rgb(21 26 59 / 8%);

  --st-white: #f4f4ee;
  --st-yellow: #ffd200;
  --st-red: #c8102e;
  --st-orange: #ff6a13;
  --st-blue: #0b4fc4;
  --st-green: #00995a;

  --font-display: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.45rem, 1.2rem + 1vw, 1.85rem);
  --step-3: clamp(1.9rem, 1.4rem + 2.2vw, 2.75rem);
  --step-4: clamp(2.4rem, 1.6rem + 3.6vw, 4.1rem);

  --radius: 22px;
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c0f24;
    --card: #161a39;
    --ink: #eef0ff;
    --muted: #a6acd8;
    --line: #2a3061;
    --brand: #7f8dff;
    --brand-soft: #222866;
    --on-brand: #0c0f24;
    --body: #07080f;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0c0f24;
  --card: #161a39;
  --ink: #eef0ff;
  --muted: #a6acd8;
  --line: #2a3061;
  --brand: #7f8dff;
  --brand-soft: #222866;
  --on-brand: #0c0f24;
  --body: #07080f;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 10px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.section { padding-block: clamp(56px, 8vw, 104px); }
.section-head { display: grid; gap: 12px; max-width: 40rem; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2 { font-size: var(--step-3); }
.section-head p { color: var(--muted); font-size: var(--step-1); }
.eyebrow {
  font: 700 var(--step--1)/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

/* Skip link for keyboard users */
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 10px 16px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-weight: 800; text-decoration: none; }
.skip:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; padding-block: 14px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
html { scroll-padding-top: 84px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 1.25rem/1 var(--font-display); }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--step--1); }
.site-nav a:hover { color: var(--ink); }

/* Buttons */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 0;
  font: 700 1.0625rem/1 var(--font-body);
  text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 0 color-mix(in srgb, var(--brand) 55%, var(--body)); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 55%, var(--body)); }
.btn-quiet { background: var(--card); color: var(--ink); border: 2px solid var(--line); }
.btn svg { width: 20px; height: 20px; flex: none; }
.soon {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 999px;
  background: var(--card); border: 2px dashed var(--line); color: var(--muted);
  font-weight: 700;
}
.soon svg { width: 20px; height: 20px; fill: currentColor; }

/* Hero */
.hero { padding-block: clamp(24px, 5vw, 64px) clamp(48px, 7vw, 96px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero h1 { font-size: var(--step-4); font-weight: 600; }
.hero h1 .solve { color: var(--brand); }
.hero .lede { font-size: var(--step-1); color: var(--muted); max-width: 34rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 4px 0 0; list-style: none; color: var(--muted); font-weight: 700; font-size: var(--step--1); }
.facts li { display: inline-flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--dot, var(--st-green)); }
.facts li:nth-child(2) { --dot: var(--st-red); }
.facts li:nth-child(3) { --dot: var(--st-blue); }
.facts li:nth-child(4) { --dot: var(--st-orange); }

/* The hero cube: 27 pieces in CSS 3D (cube.js). It starts mixed up; "Solve it" plays the solve. */
.stage { display: grid; justify-items: center; gap: 16px; min-width: 0; }
.mat {
  position: relative; width: 100%; max-width: 460px; aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  border-radius: 36px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 58%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 62%),
    var(--brand-soft);
}
.scene { --s: clamp(52px, 12vw, 78px); width: calc(var(--s) * 3); height: calc(var(--s) * 3); perspective: 1400px; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-27deg) rotateY(-42deg); }
.piece { position: absolute; width: var(--s); height: var(--s); left: calc(50% - var(--s) / 2); top: calc(50% - var(--s) / 2); transform-style: preserve-3d; }
.face { position: absolute; inset: 0; background: var(--body); backface-visibility: hidden; }
.face.on::after { content: ""; position: absolute; inset: 7%; border-radius: 16%; background: var(--c); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 14%), inset 0 2px 0 rgb(255 255 255 / 25%); }
.f-front { transform: translateZ(calc(var(--s) / 2)); }
.f-back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.f-right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.f-left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.f-top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }

/* The turn arrow, as in the app: drawn along the layer before it turns */
.turn-arrow { position: absolute; left: -50%; top: -50%; width: 200%; height: 200%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity 0.16s ease; }
.turn-arrow.is-on { opacity: 1; }
.arrow-shadow, .arrow-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.arrow-shadow { stroke: rgb(10 12 24 / 45%); }
.arrow-line { stroke: #fff; }
.arrow-head { fill: #fff; }
.arrow-head-shadow { fill: rgb(10 12 24 / 45%); stroke: rgb(10 12 24 / 45%); stroke-linejoin: round; }
.turn-arrow.is-on .arrow-line, .turn-arrow.is-on .arrow-shadow { stroke-dasharray: var(--len) var(--len); animation: draw-arrow 0.42s cubic-bezier(0.3, 0.7, 0.4, 1) both; }
.turn-arrow.is-on .arrow-head, .turn-arrow.is-on .arrow-head-shadow { animation: arrow-head 0.42s ease both; transform-box: fill-box; transform-origin: center; }
@keyframes draw-arrow { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes arrow-head { 0%, 55% { opacity: 0; transform: scale(0.4); } 100% { opacity: 1; transform: scale(1); } }
.face.on::after { transition: opacity 0.2s ease; }
.piece.dim .face.on::after { opacity: 0.38; }

/* The solve: a row of moves that light up as they play */
.moves { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 440px; margin: 0; padding: 0; list-style: none; }
.moves li {
  padding: 7px 0; border-radius: 9px; text-align: center;
  background: var(--card); border: 1.5px solid var(--line); color: var(--muted);
  font: 600 0.95rem/1 var(--font-display); transition: background 0.2s, color 0.2s, transform 0.2s;
}
.moves li.is-now { background: var(--brand); border-color: var(--brand); color: var(--on-brand); transform: translateY(-3px) scale(1.12); }
.moves li.is-blank { color: color-mix(in srgb, var(--muted) 45%, transparent); }
.moves li.is-done { color: var(--ink); border-color: color-mix(in srgb, var(--st-green) 50%, var(--line)); }
.hint { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; justify-content: center; }
.hint .note { color: var(--muted); font-weight: 700; font-size: var(--step--1); text-align: center; }
.btn-big { min-width: 180px; font-size: 1.15rem; }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }

/* Success: the cube hops, a glow rings out, confetti flies and a badge pops in */
.glow { position: absolute; left: 50%; top: 50%; width: 70%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%) scale(0.4); opacity: 0; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--st-yellow) 55%, transparent) 0%, transparent 65%); }
.mat.win .glow { animation: glow 1.4s ease-out forwards; }
@keyframes glow { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); } }
.mat.win .scene { animation: hop 0.9s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes hop { 0% { transform: none; } 35% { transform: translateY(-22px) scale(1.08); } 70% { transform: translateY(4px) scale(0.98); } 100% { transform: none; } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; }
.confetti i { position: absolute; width: 10px; height: 10px; border-radius: 3px; opacity: 0; }
.mat.win .confetti i { animation: pop 1.3s cubic-bezier(0.2, 0.7, 0.4, 1) forwards; }
@keyframes pop {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(320deg); }
}
.solved-badge {
  position: absolute; left: 50%; top: 6%; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  font: 600 1.25rem/1 var(--font-display); transform: translateX(-50%);
  animation: badge 0.6s cubic-bezier(0.3, 1.7, 0.5, 1) 0.35s both;
}
.solved-badge .stars { color: var(--st-yellow); letter-spacing: 0.06em; font-size: 1.1rem; }
@keyframes badge { from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.6); } to { opacity: 1; transform: translateX(-50%) none; } }

/* How it works: a real sequence, so the steps are numbered */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { display: grid; gap: 14px; align-content: start; padding: 28px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px;
  font: 600 1.4rem/1 var(--font-display); color: #fff; background: var(--tile, var(--st-green));
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 18%);
}
.step:nth-child(2) { --tile: var(--st-red); }
.step:nth-child(3) { --tile: var(--st-blue); }
.step h3 { font-size: var(--step-2); }
.step p { color: var(--muted); }
.step .small { font-size: var(--step--1); }

/* Screens */
.screens { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; }
.screens figure { margin: 0; display: grid; gap: 10px; }
.screens img { width: 100%; aspect-ratio: 480 / 1040; filter: drop-shadow(0 10px 18px rgb(21 26 59 / 16%)); }
.screens figcaption { font-weight: 700; font-size: var(--step--1); color: var(--muted); text-align: center; }
.fineprint { margin-top: 20px; color: var(--muted); font-size: var(--step--1); }

/* Two styles */
.styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.style-card { display: grid; gap: 16px; align-content: start; padding: clamp(24px, 3vw, 36px); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.style-card h3 { font-size: var(--step-2); }
.style-card ul { margin: 0; padding-left: 1.2em; color: var(--muted); display: grid; gap: 6px; }
.kid-line { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--brand-soft); font-weight: 700; }
.kid-line .arrow { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--st-red); display: grid; place-items: center; color: #fff; font-size: 1.2rem; }
.notation { display: flex; flex-wrap: wrap; gap: 8px; font: 700 1.05rem/1 var(--font-mono); }
.notation span { padding: 9px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--ink); }

/* Puzzles */
.shelf { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; }
.shelf li { display: grid; grid-template-rows: auto auto 1fr; gap: 10px; justify-items: center; align-content: start; padding: 18px 8px 16px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.shelf svg { width: 100%; max-width: 92px; height: auto; overflow: visible; }
.shelf .name { font: 600 1.05rem/1 var(--font-display); }
.shelf .can { display: grid; gap: 4px; justify-items: center; align-content: start; }
.tag { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--muted); }
.tag.learn { background: color-mix(in srgb, var(--st-green) 20%, var(--card)); color: var(--ink); }
.tag.scan { background: color-mix(in srgb, var(--st-blue) 20%, var(--card)); color: var(--ink); }
.puzzle-note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; margin-top: clamp(40px, 6vw, 72px); }
.modes { display: grid; gap: 22px; margin: 0; max-width: 34rem; }
.modes div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 16px; align-items: baseline; }
.modes dt { justify-self: start; }
.modes dt .tag { font-size: 0.8rem; padding: 5px 10px; }
.modes dd { margin: 0; color: var(--muted); }
.modes dd strong { display: block; color: var(--ink); font: 600 var(--step-1)/1.3 var(--font-display); margin-bottom: 2px; }
.real-shot { width: clamp(200px, 22vw, 250px); border-radius: 34px; border: 7px solid var(--body); box-shadow: var(--shadow); transform: rotate(-3deg); }

/* Made for kids */
.safe { background: var(--card); border-radius: 36px; padding: clamp(28px, 5vw, 56px); box-shadow: var(--shadow); }
.safe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 32px; list-style: none; margin: 0; padding: 0; }
.safe-grid li { display: grid; gap: 6px; align-content: start; }
.safe-grid h3 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 800; }
.safe-grid p { color: var(--muted); }
.safe .more { margin-top: 32px; font-weight: 700; }

/* Closing call to action */
.final { text-align: center; display: grid; justify-items: center; gap: 18px; }
.final h2 { font-size: var(--step-3); }
.final p { color: var(--muted); font-size: var(--step-1); max-width: 34rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 28px 40px; color: var(--muted); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); font-weight: 700; }

/* Privacy policy page */
.doc { max-width: 44rem; display: grid; gap: 18px; padding-block: 24px 80px; }
.doc h1 { font-size: var(--step-3); }
.doc h2 { font-size: var(--step-2); margin-top: 18px; }
.doc .updated { color: var(--muted); font-weight: 700; font-size: var(--step--1); }
.doc ul { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.doc .todo { padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--st-yellow) 35%, var(--card)); color: var(--ink); font-weight: 700; }

/* Large tablets and small laptops */
@media (max-width: 1080px) {
  .screens { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* Tablets */
@media (max-width: 900px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; }
  .step::before { grid-row: span 3; }
  .safe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .puzzle-note { grid-template-columns: auto minmax(0, 1fr); }
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { max-width: 40rem; }
  .mat { max-width: 380px; }
  .scene { --s: clamp(46px, 11vw, 68px); }
  .stage { justify-self: center; width: 100%; }
}
@media (max-width: 760px) {
  .styles { grid-template-columns: minmax(0, 1fr); }
  .puzzle-note { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .modes { justify-self: stretch; }
}
/* Phones */
@media (max-width: 640px) {
  .site-nav { display: none; }
  .screens { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .safe-grid { grid-template-columns: minmax(0, 1fr); }
  .site-footer .wrap { flex-direction: column; }
}
@media (max-width: 520px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .moves { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 260px; }
  .cta-row > * { flex: 1 1 100%; justify-content: center; }
  .step { grid-template-columns: minmax(0, 1fr); }
  .step::before { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mat.win .confetti i, .mat.win .glow, .mat.win .scene, .solved-badge { animation: none; }
  .moves li { transition: none; }
  .turn-arrow.is-on .arrow-line, .turn-arrow.is-on .arrow-shadow, .turn-arrow.is-on .arrow-head, .turn-arrow.is-on .arrow-head-shadow { animation: none; }
  .real-shot { transform: none; }
  .btn { transition: none; }
}

/* 404 page */
.lost { display: grid; gap: 18px; justify-items: start; padding-block: clamp(48px, 12vw, 140px); max-width: 36rem; }
.lost h1 { font-size: var(--step-4); }
.lost p { color: var(--muted); font-size: var(--step-1); }
